Home

C Programming 1000+ MCQ with answer for SSC MTS

Thursday 9th of March 2023

Sharing is caring

1. unsigned' is a valid variable name.
A. True
B. False
C.
D.
Answer : B
2. Identify the wrong statement
A. putchar(65)
B. putchar('x')
C. putchar("x")
D. putchar('
')
Answer : C
3. All elements of a structure are allocated contiguous memory locations.
A. True
B. False
C.
D.
Answer : A
4. 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
5. The same variable names of automatic type can be used in different functions without any conflict.
A. True
B. False
C.
D.
Answer : A
6. = and = = have the same operation.
A. True
B. False
C.
D.
Answer : B
7. 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
8. The output of the following code is:
main() 
{
int a[10], i;
for (i = 1; I <= 0; i++)
{
scanf("%d", a[i]);
printf("%d", a[i]);
}
}

A. 10
B. Logical error
C. Runtime error
D. 1 to 10 will be displayed
Answer : B
9. Which escape character can be used to beep from speaker in C?
A. \a
B. \b
C. \m
D.
Answer : A
10. How many times the following loop will execute?
for (a = 0; a < 4; a++)
printf("hello
");

A. 3
B. 4
C. 5
D. infinite
Answer : B
11. Which of the following is allowed in a C Arithmetic instruction
A. []
B. {}
C. ()
D. None of the above
Answer : C
12. All macro substitutions in a program are done before compilation of the program.
A. True
B. False
C.
D.
Answer : A
13. struct stud
{
int roll;
char name[20];
float marks;
} *p;
What will be the byte size of p?

A. 24
B. 2
C. 26
D. None
Answer : B
14. In the expression - 'x + y + 3z =20'
A. x + y' is a keyword
B. 3 and 20 are constants
C. 3z is a constant
D. y is a variable and z is a constant
Answer : B
15. 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
16. Only one break can be used in one loop.
A. True
B. False
C.
D.
Answer : B
17. Which of the following is not recommended in a header file?
A. Type definitions (typedefs)
B. Class definitions
C. Function definitions
D. Template definitions
Answer : D
18. The main() function can call itself recursively.
A. True
B. False
C.
D.
Answer : A
19. Which one of the following is not a fundamental data type in C++
A. float
B. string
C. int
D. wchar_t
Answer : A
20. 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
21. 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
22. What is right way to Initialization array?
A. int num[6] = { 2, 4, 12, 5, 45, 5 } ;
B. int n{} = { 2, 4, 12, 5, 45, 5 } ;
C. int n{6} = { 2< 4< 12 } ;
D. int n(6) = { 2, 4, 12, 5, 45, 5 } ;
Answer : A
23. 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
24. Which of the following is invalid?
A. ''
B. " "
C. 'a'
D. abc'
Answer : D
25. A recursive function calls itself again and again.
A. True
B. False
C.
D.
Answer : A
26. The output of the following code is:
main() 
{
int a = 0;
for (; i = 0; i++)
printf("%d", a);
}

A. 0
B. Nothing will be displayed
C. Infinite loop
D. None of the above
Answer : D
27. && and & operators have the same meaning.
A. True
B. False
C.
D.
Answer : B
28. The size of signed integer is ------ bytes.
A. 4
B. 2
C. 8
D. 10
Answer : B
29. 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
30. Union is used to hold different data at different time.
A. True
B. False
C.
D.
Answer : A
31. 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
32. static variable will not always have assigned value.
A. True
B. False
C.
D.
Answer : A
33. 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
34. It is necessary to initialize the array at the time of declaration.
A. True
B. False
C.
D.
Answer : B
35. 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
36. Which one of the following is not a valid reserved keyword in C++
A. Explicit
B. Public
C. Implicit
D. Private
Answer : C
37. The expression "b = 3 ^ 2;" will evaluate b = 9.
A. True
B. False
C.
D.
Answer : B
38. An array declared as A[100][100] can hold a maximum of 100 elements.
A. True
B. False
C.
D.
Answer : B
39. There are total ------ numbers of operators in 'C'.
A. 35
B. 45
C. 55
D. 40
Answer : B
40. What is C Tokens?
A. The smallest individual units of c program
B. The basic element recognized by the compiler
C. The largest individual units of program
D. A & B Both
Answer : D
41. strcat() function ----------------------- two strings.
A. delete
B. concatenate
C. compare
D. none of the above
Answer : B
42. Left shift operator rotates the bits on the left and places them to the right.
A. True
B. False
C.
D.
Answer : B
43. Nested macros are allowed.
A. True
B. False
C.
D.
Answer : B
44. Which among the following is a unconditional control structure
A. do-while
B. if-else
C. goto
D. for
Answer : C
45. emp name' is a valid variable name.
A. True
B. False
C.
D.
Answer : B
46. The expression (i + j)++ is illegal.
A. True
B. False
C.
D.
Answer : A
47. 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
48. enum helps to create user defined datatype.
A. True
B. False
C.
D.
Answer : A
49. 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
50. Which of the following is not a preprocessor directive
A. #if
B. #elseif
C. #undef
D. #pragma
Answer : B

Sharing is caring