Home

1000+ C Programming MCQ for SSC JE [Solved]

Thursday 9th of March 2023

Sharing is caring

1. Which of the following is an example of compounded assignment statement?
A. a = 5
B. a += 5
C. a = b = c
D. a = b
Answer : C
2. When a user defined function is defined in program, then it has to be called at least once from the main().
A. True
B. False
C.
D.
Answer : B
3. The output of the following code is:
main() 
{
int k, num = 30;
k = (num > 5 ? (num <= 10 ? 100 : 200) : 500);
printf("
%d", num);
}

A. 200
B. 500
C. 30
D. Unpredictable
Answer : C
4. What's wrong? while( (i < 10) && (i > 24))
A. the logical operator && cannot be used in a test condition
B. the while loop is an exit-condition loop
C. the test condition is always true
D. the test condition is always false
Answer : D
5. C is a ___ language
A. High Level and Procedural
B. Low Level and OOPS
C. Middle Level and Procedural
D. Machine Level and OOPS
Answer : A
6. && and & operators have the same meaning.
A. True
B. False
C.
D.
Answer : B
7. What is Keywords?
A. Keywords have some predefine meanings and these meanings can be changed.
B. Keywords have some unknown meanings and these meanings cannot be changed.
C. Keywords have some predefine meanings and these meanings cannot be changed.
D. None of the above
Answer : C
8. The output of the following code is:
void main() 
{
float a;
int x = 10, y = 3; a = x / y;
printf("%f", a); }

A. 3.999999
B. Error
C. 3
D. 3.000000
Answer : D
9. static variable will not always have assigned value.
A. True
B. False
C.
D.
Answer : A
10. The array 'char name[10] can consist of a maximum of 9 characters.
A. True
B. False
C.
D.
Answer : A
11. The output of the following code is:
void main()
{
int a = 20;
printf("%d\t%d
", ++a, a);
}

A. 21 21
B. 20 21
C. 21 20
D. 20 20
Answer : C
12. printf("%d", sizeof('2')); will print 2.
A. True
B. False
C.
D.
Answer : B
13. What would be the output of the following program?
int x=40;
main(){
int x=20;
printf("
%d",x);
}

A. 40
B. 20
C. Compilation Error
D. Garbeg Value
Answer : B
14. What will be output if you will compile and execute the following c code?
#include 
int main(){
int i=320;
char *ptr=(char *)&i;
printf("%d",*ptr);
return 0;
}

A. 1
B. 64
C. 320
D. Compiler Error
Answer : B
15. The output of the following code is:
main() 
{
unsigned int a = 10;
while (a>=10)
{
int a; a-- ;
}
printf("%i", a);
}

A. Infinite loop
B. 9
C. 0
D. None
Answer : A
16. There are total ------ numbers of operators in 'C'.
A. 35
B. 45
C. 55
D. 40
Answer : B
17. Which of the following is allowed in a C Arithmetic instruction
A. []
B. {}
C. ()
D. None of the above
Answer : C
18. Which of the following keyword supports dynamic method resolution?
A. abstract
B. Virtual
C. Dynamic
D. Typeid
Answer : A
19. Which of the following is the most preferred way of throwing and handling exceptions?
A. Throw by value and catch by reference.
B. Throw by reference and catch by reference.
C. Throw by value and catch by value
D. Throw the pointer value and provide catch for teh pointer type.
Answer : B
20. Left shift operator rotates the bits on the left and places them to the right.
A. True
B. False
C.
D.
Answer : B
21.

What will be output if you will compile and execute the following c code?


#include 
#define x 5+2
int main(){
int i;
i=x*x*x;
printf("%d",i);
return 0;
}



A. 27
B. 343
C. 233
D. Compiler Error
Answer : A
22. What will be output if you will compile and execute the following c code?
#include 
int main()
{
float a=5.2;
if(a==5.2)
printf("Equal");
else if(a<5.2)
printf("Less than");
else
printf("Greater than");
return 0;
}

A. Less than
B. Equal
C.

Greater than


D. None of above
Answer : A
23. No commas or blanks are allowed within an integer or a real constant.
A. True
B. False
C.
D.
Answer : A
24. An array elements are always stored in _________ memory locations.
A. Sequential
B. Random
C. Sequential and Random
D. None of the above
Answer : A
25. Variables declared as register storage type gets stored in CPU registers.
A. True
B. False
C.
D.
Answer : A
26. Which of the following is not a standard exception built in C++.
A. std::bad_creat
B. std::bad_alloc
C. std::bad_cast
D. std::bad_typeid
Answer : A
27. continue statement is used
A. to go to the next iteration in a loop
B. come out of a loop
C. exit and return to the main function
D. restarts iterations from beginning of loop
Answer : D
28. Union is used to hold different data at different time.
A. True
B. False
C.
D.
Answer : A
29. The default initial value of automatic storage class is 0.
A. True
B. False
C.
D.
Answer : B
30. If 'str' is a string of 7 characters, the statement printf("%4s", str); will display ------characters.
A. 4
B. 7
C. 6
D. 0
Answer : A
31. What does STL stand for?
A. Simple Template Library
B. Standard Template Library
C. Static Type Library
D. Single Type-based Library
Answer : A
32. For 16?bit compiler allowable range for integer constants is ______ ?
A. ?3.4e38 to 3.4e38
B. ?32767 to 32768
C. ?32768 to 32767
D. ?32668 to 32667
Answer : C
33. The output of the following code is:
main() 
{
int a = 5, b = 6;
(a == b? printf("%d", a));
}

A. 0
B. 5
C. Error
D. None of the above
Answer : C
34. If the class name is X, what is the type of its “this” pointer (in a nonstatic, non-const member function)?
A. const X* const
B. X* const
C. X*
D. X&
Answer : D
35. The-------------------- statement helps immediate exit from any part of the loop
A. break
B. continue
C. exit
D. All of the above
Answer : A
36. unsigned' is a valid variable name.
A. True
B. False
C.
D.
Answer : B
37. A pointer is an indication of the variable to be accessed next.
A. True
B. False
C.
D.
Answer : B
38. Which of the following expressions is wrong
A. float a =123.56;
B. char ch ='T' * 'A';
C. char ch ='T' *20;
D. 3 +a = b;
Answer : D
39. Bitwise operators can operate upon?
A. double and chars
B. floats and doubles
C. ints and floats
D. ints and chars
Answer : D
40. The output of the following code is:
main() 
{
xyz: goto abc;
printf("Hello");
abc: printf("World");
goto xyz;
}

A. Infinite loop
B. Hello World
C. World Hello
D. Compilation error
Answer : A
41. The output of the following code is:
void main() 
{
char a = 'B';
switch (a)
{
case 'A' : printf("a");
case 'B' : printf("b");
default : printf("c");
}

A. B
B. b
C. bca
D. bc
Answer : D
42. do-while loop is useful when we want the statements within the loop must be executed
A. Only once
B. At least once
C. More than Once
D. Any one of the above
Answer : B
43. emp name' is a valid variable name.
A. True
B. False
C.
D.
Answer : B
44. perror( ) function used to ?
A. Work same as printf()
B. prints the error message specified by the compiler
C. prints the garbage value assigned by the compiler
D. None of the above
Answer : B
45. A continue statement causes execution to skip to
A. the return 0; statement
B. the first statement after the loop
C. the statement following the continue statement
D. the next iteration of the loop
Answer : C
46. Which of the following is not true about preprocessor directives
A. They begin with a hash symbol
B. They are processed by a preprocessor
C. They form an integral part of the code
D. They have to end with a semi colon
Answer : A
47. Operation between an integer and float always yields a float result.
A. True
B. False
C.
D.
Answer : A
48. A declaration float a, b; occupies ___ of memory
A. 1 byte
B. 4 bytes
C. 8 bytes
D. 16 bytes
Answer : C
49. What's wrong? (x = 4 && y = 5) ? (a = 5) ; (b = 6);
A. the question mark should be an equal sign
B. the first semicolon should be a colon
C. there are too many variables in the statement
D. the conditional operator is only used with apstrings
Answer : D
50. printf() is not a library function.
A. True
B. False
C.
D.
Answer : B

Sharing is caring