Home

1000+ C Programming Multiple Choice Question Answer [Solved]

Thursday 9th of March 2023

Sharing is caring

1. Which of the following is not a preprocessor directive
A. #if
B. #elseif
C. #undef
D. #pragma
Answer : B
2. Single operations involving entire arrays are permitted in C.
A. True
B. False
C.
D.
Answer : A
3. The size of signed integer is ------ bytes.
A. 4
B. 2
C. 8
D. 10
Answer : B
4. The output of the following code is:
#define sqr(x= x*x) 
main()
{
int a = 10, b = 5;
printf("%d, %d", sqr(a+b),sqr(++a));
}

A. 77, 121
B. 225, 121
C. 77< 144
D. Compilation error
Answer : D
5. C programming language was developed by
A. Dennis Ritchie
B. Ken Thompson
C. Bill Gates
D. Peter Norton
Answer : A
6. It is necessary to initialize the array at the time of declaration.
A. True
B. False
C.
D.
Answer : B
7. Which of the following is allowed in a C Arithmetic instruction
A. []
B. {}
C. ()
D. None of the above
Answer : C
8. 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
9. The-------------------- statement helps immediate exit from any part of the loop
A. break
B. continue
C. exit
D. All of the above
Answer : A
10. 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
11. There are total ------ numbers of operators in 'C'.
A. 35
B. 45
C. 55
D. 40
Answer : B
12. 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
13. Left shift operator rotates the bits on the left and places them to the right.
A. True
B. False
C.
D.
Answer : B
14. Structures within structures cannot be created.
A. True
B. False
C.
D.
Answer : B
15. Nested macros are allowed.
A. True
B. False
C.
D.
Answer : B
16. Every if statement can be converted into an equivalent switch statement.
A. True
B. False
C.
D.
Answer : B
17. 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
18. fprintf()function can be used to write into console.
A. True
B. False
C.
D.
Answer : B
19. C programs are converted into machine language with the help of
A. An Editor
B. A compiler
C. An operating system
D. None of the above
Answer : B
20. 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
21. 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
22. Expression 4**3 evaluates to 64.
A. True
B. False
C.
D.
Answer : B
23. 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
24. 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
25. The printf() function retunes which value when an error occurs?
A. Positive value
B. Zero
C. Negative value
D. None of these
Answer : C
26. Only one break can be used in one loop.
A. True
B. False
C.
D.
Answer : B
27. What's wrong? for (int k = 2, k <=12, k++)
A. the increment should always be ++k
B. the variable must always be the letter i when using a for loop
C. there should be a semicolon at the end of the statement
D. the commas should be semicolons
Answer : B
28. Union is used to hold different data at different time.
A. True
B. False
C.
D.
Answer : A
29. /* The C language.
/* is a procedural language .*/*/
The above statement is valid.

A. True
B. False
C.
D.
Answer : B
30. ------ is the ternary operator
A. ?,-
B. ?,:
C. ++<--
D. none of the above
Answer : B
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. The identifier argv[] is a pointer to an array of strings.
A. True
B. False
C.
D.
Answer : B
33. Which of the following is invalid?
A. ''
B. " "
C. 'a'
D. abc'
Answer : D
34. All elements of a structure are allocated contiguous memory locations.
A. True
B. False
C.
D.
Answer : A
35. 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
36. 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
37. 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
38. An array elements are always stored in _________ memory locations.
A. Sequential
B. Random
C. Sequential and Random
D. None of the above
Answer : A
39. Which of the following correctly describes C++ language?
A. Statically typed language
B. Dynamically typed language
C. Both Statically and dynamically typed language
D. Type-less language
Answer : D
40. The main() function can call itself recursively.
A. True
B. False
C.
D.
Answer : A
41. gets() and puts() are unformatted I/O functions.
A. True
B. False
C.
D.
Answer : A
42. 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
43. emp name' is a valid variable name.
A. True
B. False
C.
D.
Answer : B
44. the value *(&i) is same as printing the value of address of i.
A. True
B. False
C.
D.
Answer : B
45. char *s[10] defines an array of ------------------------
A. pointers to strings
B. string to pointer
C. both
D.
Answer : A
46. The expression 'int j = 6 + 3 % -9;' evaluates to -1.
A. True
B. False
C.
D.
Answer : B
47. 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
48. Character data types cannot be declared as unsigned.
A. True
B. False
C.
D.
Answer : B
49. 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
50. Which of the STL containers store the elements contiguously (in adjecent memory locations)?
A. std::vector
B. std::list
C. std::map
D. std::set
Answer : C

Sharing is caring