Home

C Programming 1000+ MCQ with answer for SSC CPO

Thursday 9th of March 2023

Sharing is caring

1. The main() function can be called from any other function.
A. True
B. False
C.
D.
Answer : A
2. What is the right way to access value of structure variable book{ price, page }?
A. printf("%d%d", book.price, book.page);
B. printf("%d%d", price.book, page.book);
C. printf("%d%d"< price::book< page::book);
D. printf("%d%d", price?>book, page?>book);
Answer : A
3. unsigned char has a range from 0 to ------------
A. 253
B. 254
C. 255
D. 256
Answer : C
4. printf() is not a library function.
A. True
B. False
C.
D.
Answer : B
5. fprintf()function can be used to write into console.
A. True
B. False
C.
D.
Answer : B
6. Left shift operator rotates the bits on the left and places them to the right.
A. True
B. False
C.
D.
Answer : B
7. Structures within structures cannot be created.
A. True
B. False
C.
D.
Answer : B
8. unsigned' is a valid variable name.
A. True
B. False
C.
D.
Answer : B
9. What is an array?
A. An array is a collection of variables that are of the dissimilar data type.
B. An array is a collection of variables that are of the same data type.
C. An array is not a collection of variables that are of the same data type.
D. None of the above.
Answer : B
10. The -------------------------- loop executes at least once.
A. for
B. while
C. do-while
D. while & do-while
Answer : C
11. The array 'char name[10] can consist of a maximum of 9 characters.
A. True
B. False
C.
D.
Answer : A
12. An array elements are always stored in _________ memory locations.
A. Sequential
B. Random
C. Sequential and Random
D. None of the above
Answer : A
13. 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
14. All elements of a structure are allocated contiguous memory locations.
A. True
B. False
C.
D.
Answer : A
15. gets() and puts() are unformatted I/O functions.
A. True
B. False
C.
D.
Answer : A
16. && and & operators have the same meaning.
A. True
B. False
C.
D.
Answer : B
17. 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
18. The output of the following code is:
void main()
{
int z, a = 5, b = 3; z = a * 2 + 26 % 3;
printf("%d", z); }

A. 10
B. 0
C. 12
D. None of the above
Answer : C
19. 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
20. The output of the following code is:
void main() 
{
int a;
int &b = a;
a=100;
printf("b=%d\ta=%d
", b,a);
}

A. b=100 a=100
B. b=100 a=0
C. b=0 a=100
D. Error
Answer : D
21. The printf() function retunes which value when an error occurs?
A. Positive value
B. Zero
C. Negative value
D. None of these
Answer : C
22. Union is used to hold different data at different time.
A. True
B. False
C.
D.
Answer : A
23. Only one break can be used in one loop.
A. True
B. False
C.
D.
Answer : B
24. 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
25. 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
26. The-------------------- statement helps immediate exit from any part of the loop
A. break
B. continue
C. exit
D. All of the above
Answer : A
27. 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
28. Which options shows the correct hierarchy of arithmetic operators
A. **, * or /, + or -
B. **, *, /, +, -
C. **< /< *< +<-
D. / or *, - or +
Answer : D
29. The contents of a file opened in 'r+' mode cannot be changed.
A. True
B. False
C.
D.
Answer : B
30. No commas or blanks are allowed within an integer or a real constant.
A. True
B. False
C.
D.
Answer : A
31. enum helps to create user defined datatype.
A. True
B. False
C.
D.
Answer : A
32. Every if statement can be converted into an equivalent switch statement.
A. True
B. False
C.
D.
Answer : B
33. The output of the following code is:
main() 
{
void msg()
{
printf("HELLO WORLD");
}
}

A. HELLO WORLD
B. Error
C. None of the above
D. Null
Answer : B
34. Which of the following keyword supports dynamic method resolution?
A. abstract
B. Virtual
C. Dynamic
D. Typeid
Answer : A
35. The output of the following code is:
void main() 
{
int a = 0;
while (a<=50) for(;;) if(++a % 50==0) break;
printf("a = %d", a);
}

A. a = 100
B. a = 50
C. compilation error
D. runtime error
Answer : A
36. 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
37. 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
38. static variable will not always have assigned value.
A. True
B. False
C.
D.
Answer : A
39. /* The C language.
/* is a procedural language .*/*/
The above statement is valid.

A. True
B. False
C.
D.
Answer : B
40. Which of the following is invalid?
A. ''
B. " "
C. 'a'
D. abc'
Answer : D
41. Which of the following is a valid destructor of the class name "Country"
A. int ~Country()
B. void Country()
C. int ~Country(Country obj)
D. void ~Country()
Answer : B
42. A function to be called must be ended with a----------------
A. .
B. ?
C. ;
D. none of the above
Answer : C
43. The expression (i + j)++ is illegal.
A. True
B. False
C.
D.
Answer : A
44. Which of the following is not an infinite loop
A. int i =1;
while (1)
{i++;}
B. for( ; ; );
C. int true=0< false;
while (true)
{false = 1;}
D. int y, x = 0;
do
{y = x;}
while (x==0);
Answer : C
45. A pointer is an indication of the variable to be accessed next.
A. True
B. False
C.
D.
Answer : B
46. It is necessary to initialize the array at the time of declaration.
A. True
B. False
C.
D.
Answer : B
47. 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
48. Which among the following is a unconditional control structure
A. do-while
B. if-else
C. goto
D. for
Answer : C
49. The output of the following code is:
void main() 
{
int a = 1, b=2;
int *ip;
ip=&a;
b=*ip;
printf("%d", b);
}

A. 2
B. 1
C. 100
D. 0
Answer : B
50. 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

Sharing is caring