C Programming MCQ Questions and Answers Part – 2

4367

C Programming MCQ Questions and Answers Part – 1

C Programming MCQ Questions and Answers Part – 2

C Programming MCQ Questions and Answers Part – 3

51. What is the ASCII range for A to Z letters?
A. 65 to 90.
B. 48 to 57.
C. 97 to 122
D. 86 to 98.
ANSWER: A
52. The escape sequence \t is a_________.
A. tab.
B. next line.
C. backspace.
D. skip the line.
ANSWER: A
53. Which is the correct statement for finding the cube of 2?
A. pow(2,3);.
B. pow(3,2);.
C. pow(3);.
D. pow(2);.
ANSWER: A
54. The abs() function displays________.
A. absolute value.
B. negative value.
C. zero value.
D. positive value
ANSWER: A
55. The switch statement is used to________.
A. switch between functions in a program.
B. switch from one variable to another variable.
C. choose from multiple possibilities which may arise due to different values of a single variable.
D. use switching variables.
ANSWER: C
56. The default statement is executed in switch case when________.
A. all the case statements are false.
B. one of the case is true.
C. one of the case is false
D. all the case statements are true.
ANSWER: A
57. Each case statement in switch () is separated by______.
A. break.
B. continue.
C. exit().
D. goto.
ANSWER: A
58. The keyword else can be used with________.
A. if statement.
B. switch() statement.
C. do while statement.
D. if..else statement
ANSWER: A
59. How many while statements are possible in do..while loop?
A. 2
B. 1
C. 4
D. 3
ANSWER: B
60. An array is a collection of_________.
A. different data types.
B. same data types.
C. different data types.
D. only one data type.
ANSWER: B
61. ++ is ____ operator
A. a binary
B. a unary
C. a assignment
D. a logical
ANSWER: B
62. A character array always ends with________.
A. null (\0) character.
B. question mark (?).
C. full stop(.).
D. exclamation mark(!).
ANSWER: A
63. If you delete array without stating the elements it will be set to________.
A. a null value.
B. zero.
C. garbage value
D. no value.
ANSWER: A
64. Arrays cannot be initialized if they are________.
A. automatic.
B. external.
C. static.
D. dynamic.
ANSWER: A
65. All the elements in the array must be________.
A. initialized.
B. defined.
C. initialized, defined.
D. created.
ANSWER: A
66. The string always ends with__________.
A. \0 character.
B. \character.
C. 0\ character.
D. 0 character.
ANSWER: A
67. The fastest way to exchange two rows in a two-dimensional array is________.
A. exchange the addresses of each element in the two rows.
B. exchange the elements of the two rows.
C. store the addresses of the rows in an array of pointers and exchange the pointers.
D. exchange both address and pointers in each row.
ANSWER: C
68. Which header file is essential for using strcmp() function?
A. string.h;
B. strings.h;
C. text.h;
D. strcmp.h
ANSWER: A
69. Arrays are passed as arguments to a function by_________.
A. value.
B. reference.
C. value, reference.
D. recursion
ANSWER: B
70. It is necessary to declare the type of a function in the calling program if _______.
A. the function returns a non-integer value.
B. the function returns an integer.
C. the function is not defined in the same file.
D. the function is defined in the same file.
ANSWER: A
71. Recursion is a process in which a function calls _________.
A. itself.
B. another function.
C. main( ) function.
D. sub program.
ANSWER: A
72. By default the function returns_______.
A. integer value.
B. float value.
C. char value.
D. double.
ANSWER: A
73. The meaning of keyword void before the function name means________.
A. function should not return any value.
B. function should return a value.
C. no arguments are passed.
D. some arguments are passed
ANSWER: A
74. The function name itself is_________.
A. an address.
B. value.
C. definition.
D. statement.
ANSWER: A
75. A global pointer can access variable of________.
A. all user-defined functions.
B. only main() function.
C. only library functions.
D. external functions.
ANSWER: D
76. Which among the following is a unconditional control structure?
A. do-while.
B. if-else.
C. goto.
D. for.
ANSWER: C
77. A static variable is one that________.
A. retains its value throughout the life of the program.
B. cannot be initialized.
C. is initialized once at the commencement of the execution and cannot be changed at the run time.
D. is same as an automatic variable but is placed at the head of the program.
ANSWER: C
78. An external variable is one_______.
A. which is globally accessible by all functions.
B. which is declared outside the body of any function.
C. which resides in the memory till the end of the program.
D. which is locally accessible by all functions.
ANSWER: A
79. If a storage class is not mentioned in the declaration then default storage class is_________.
A. automatic.
B. static.
C. external.
D. register.
ANSWER: A
80. If the CPU fails to keep the variable in CPU registers, in that case the variables are
assumed_______.
A. automatic.
B. static.
C. external.
D. register.
ANSWER: D
81. Identify the most appropriate sentence to describe the unions_______.
A. unions contain members of different data types which share the same storage area in memory.
B. unions are like structures.
C. unions are less frequently used in the program.
D. unions are used for set operations.
ANSWER: A
82. The member variable of structure is accessed by using______.
A. dot (.) operator.
B. arrow (->) operator.
C. asterisk * operator.
D. ampersand & operator.
ANSWER: A
83. The structure combines variables of_______.
A. similar data types.
B. dissimilar data types.
C. unsigned data types.
D. signed data types.
ANSWER: B
84. The typedef statement is used for________.
A. declaring user-defined data types.
B. declaring variant variables.
C. for typecasting of variables.
D. for typing static variables.
ANSWER: A
85. The number of bytes required for enumerated data type in memory are________.
A. 1 bytes.
B. 4 bytes.
C. 2 bytes.
D. 3 bytes
ANSWER: C
86. Which data type is most suitable for storing a number 65000 in a 32-bit system?
A. short.
B. int.
C. long.
D. double.
ANSWER: A
87. Which of the following is not a correct variable type?
A. float.
B. real.
C. int.
D. 0x16.
ANSWER: B
88. The number of digits present after decimal in float is________.
A. 4.
B. 1.
C. 16.
D. 6.
ANSWER: D
89. In a 32-bit compiler, which 2 types have same size? B. C. D.
A. char and int.
B. int and float.
C. short and int.
D. float and double.
ANSWER: B
90. The union holds_______.
A. one object at a time.
B. multiple objects.
C. different objects.
D. two object.
ANSWER: A
91. Bit fields are used only with________.
A. int data type.
B. float data type.
C. char data type.
D. unsigned int data type.
ANSWER: D
92. The fscanf () statements reads data from________.
A. file.
B. keyboard.
C. put.
D. get.
ANSWER: A
93. When fopen () fails to open a file it returns______.
A. NULL.
B. -1.
C. 0.
D. -1.
ANSWER: A
94. A file opened in w+ mode can be________.
A. read/write.
B. only read.
C. only write.
D. only close.
ANSWER: A
95. Command line arguments are used to accept argument from________.
A. command prompt of operating system.
B. . through scanf( ) statement.
C. both (a) and (b).
D. through printf() statement
ANSWER: A
96. The redirection operator > transfers any output to________.
A. text file.
B. console.
C. binary file.
D. number file.
ANSWER: B
97. This function is used to detect the end of file________.
A. feof( ).
B. ferror( ).
C. fputs( ).
D. fgetch( ).
ANSWER: A
98. The EOF is equivalent to_______.
A. -1.
B. 0.
C. 1.
D. {}.
ANSWER: B
99. The scanf() statement is an_______.
A. input.
B. output.
C. pointer.
D. file.
ANSWER: A
100. what is file?
A. collection of records.
B. collection of arguments.
C. group of arguments
D. all.
ANSWER: A

Previous articleC Programming MCQ Questions and Answers Part – 1
Next articleC Programming MCQ Questions and Answers Part – 3
Author and Assistant Professor in Finance, Ardent fan of Arsenal FC. Always believe "The only good is knowledge and the only evil is ignorance - Socrates"