

MCQOPTIONS
Saved Bookmarks
This section includes 191 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.
51. |
Consider the following statement:#define hypotenuse (a, b) sqrt (a*a + b*b);The macro-call hypotenuse (a + 2, b + 3); |
A. | finds hypotenuse of triangle with sides a + 2 and b+3 |
B. | finds square root of (a + 2)2 + (b + 3)2 |
C. | is meaningless |
D. | finds square root of 3*a + 4*b + 5 |
Answer» E. | |
52. |
If integer needs two bytes of storage, then maximum value of a signed interger is |
A. | 2^16-1 |
B. | 2^15-1 |
C. | 2^16 |
D. | None of these |
Answer» C. 2^16 | |
53. |
Which of the following operator has lowest precedence amongst all the operators ? |
A. | Modulus |
B. | Comma |
C. | Plus |
D. | Logical AND |
Answer» C. Plus | |
54. |
Declare the following statement?"An array of three pointers to chars". |
A. | char *ptr[3](); |
B. | char *ptr[3]; |
C. | char (*ptr[3])(); |
D. | char **ptr[3]; |
Answer» C. char (*ptr[3])(); | |
55. |
1 :typedef long a;extern int a c;2 :typedef long a;extern a int c;3 :typedef long a;extern a c; |
A. | 1 correct |
B. | 2 correct |
C. | 3 correct |
D. | 1, 2, 3 are correct |
Answer» D. 1, 2, 3 are correct | |
56. |
The program fragment int i = 263 ; putchar (i) ; prints |
A. | 263 |
B. | ASCII equivalent of 263 |
C. | rings the bell |
D. | garbage |
Answer» D. garbage | |
57. |
printf ( "%d" , printf ( "tim" ) ): |
A. | results in a syntax error |
B. | outputs tim3 |
C. | outputs garbage |
D. | prints tim and terminates abruptly |
Answer» C. outputs garbage | |
58. |
Integer division in a 'C' program results in: |
A. | Truncation |
B. | Rounding |
C. | Underflow |
D. | None of these |
Answer» B. Rounding | |
59. |
Comment on the following expression? c = (n) ? a : b; can be rewritten as |
A. | if (!n)c = b; else c = a; |
B. | if (n <= 0)c = b; else c = a; |
C. | if (n > 0)c = a; else c = b; |
D. | All of the mentioned |
Answer» B. if (n <= 0)c = b; else c = a; | |
60. |
Which of the following method are accepted for assignment? |
A. | 5 = a = b = c = d; |
B. | a = b = c = d = 5; |
C. | a = b = 5 = c = d; |
D. | None of the mentioned |
Answer» C. a = b = 5 = c = d; | |
61. |
Which of the following is true of external variables? |
A. | they provide a way for two way communication between functions |
B. | their scope extends from the point of definition through the remainder of the program |
C. | if they are not initialized, they will be initilised to zero |
D. | All of the above |
Answer» E. | |
62. |
What do the following declaration signify?int *ptr[30]; |
A. | ptr is a pointer to an array of 30 integer pointers. |
B. | ptr is a array of 30 pointers to integers. |
C. | ptr is a array of 30 integer pointers. |
D. | ptr is a array 30 pointers. |
Answer» C. ptr is a array of 30 integer pointers. | |
63. |
As soon as a pointer variable is freed, its value |
A. | is set to null |
B. | becomes unpredictable |
C. | is set to 1 |
D. | remains the same |
Answer» E. | |
64. |
Which expression has to be present in the following? exp1 ? exp2 : exp3; |
A. | exp1 |
B. | exp2 |
C. | exp3 |
D. | All of the mentioned |
Answer» E. | |
65. |
If a variable can take only integral values from 0 to n. where n is a constant integer, then the variable can be represented as a bit-field whose width is the integral part of (the log in the answers arc to the base 2) |
A. | log (n) + 1 |
B. | log (n - 1) + 1 |
C. | log (n + 1) + 1 |
D. | none of the above |
Answer» B. log (n - 1) + 1 | |
66. |
The rule for implicit type conversion is |
A. | int < unsigned < float < double |
B. | unsigned < int < float < double |
C. | int < unsigned < double < float |
D. | unsigned < inc < double < float |
Answer» B. unsigned < int < float < double | |
67. |
Arrange the following operators in decreasing order of Operator Precedence.1. Arithmetic Operator2. Unary Operator3. Comparison Operator4. Shift Operator |
A. | 2 1 3 4 |
B. | 1 2 3 4 |
C. | 2 1 4 3 |
D. | 1 2 4 3 |
Answer» D. 1 2 4 3 | |
68. |
Unary Operators are Operators having ____________. |
A. | Highest Precedence |
B. | Lowest Precedence |
C. | Depends on the compiler |
D. | None of the above |
Answer» B. Lowest Precedence | |
69. |
The value of ab if ab & 0 x 3f equals 0 x 27 is |
A. | 047 |
B. | 0 x 0 f |
C. | 0 x f3 |
D. | 0 x 27 |
Answer» E. | |
70. |
The declarations typedef float hight [100]; height men, women; |
A. | define men and women as 100 element floating point arrays |
B. | define men and women as floating point variables |
C. | define height, men and women as floating point variables |
D. | are illegal |
Answer» B. define men and women as floating point variables | |
71. |
The library function sqrt operates on a double precision argument. If, i is an integer variable, then which of the following calls would correctly compute sqrt(i)? |
A. | sqrt((double)i) |
B. | (double)sqrt(i)? |
C. | (double)(sqrt(i)) |
D. | sqrt(i) |
Answer» B. (double)sqrt(i)? | |
72. |
Which of the following can have different meaning in different contexts? |
A. | & |
B. | * |
C. | both a and b |
D. | None of the above |
Answer» B. * | |
73. |
In case of ordinary int variables |
A. | leftmost bit is reserved for sign |
B. | rightmost bit is reserved for sign |
C. | no bit is reserved for sign |
D. | none of these |
Answer» B. rightmost bit is reserved for sign | |
74. |
Which of the following comments regarding the reading of a string, using scanf(with optional) and get is true? |
A. | Both can be used interchangeably |
B. | Scanf is delimited by end of line, while gets is not |
C. | Scanf is delimited by blank, while gets is not |
D. | All of above |
Answer» D. All of above | |
75. |
The declaration "unsigned u" indicates u is a/an |
A. | unsigned character |
B. | unsigned integer |
C. | character |
D. | none of' these |
Answer» C. character | |
76. |
Given b=110 and c=20, what is the value of 'a' after execution of the expression a=b-=c*=5? |
A. | 450 |
B. | 10 |
C. | 110 |
D. | -10 |
Answer» C. 110 | |
77. |
The rule for implicit type conversion in 'C' is |
A. | int < unsigned < float < double |
B. | unsigned < int < float < double |
C. | int < unsigned < double < float |
D. | unsigned < int < double < float |
Answer» B. unsigned < int < float < double | |
78. |
The variables which can be accessed by all modules in a program, are called |
A. | local variables |
B. | internal variables |
C. | external variable |
D. | global variables |
Answer» E. | |
79. |
Arithmetic Operator has associtivity from ___________ to ____________. |
A. | Right to Left |
B. | Left to Right |
C. | Top to Bottom |
D. | None of the above |
Answer» C. Top to Bottom | |
80. |
Which of the following 'C' type is not a primitive data structure? |
A. | int |
B. | float |
C. | char |
D. | none of these |
Answer» E. | |
81. |
sizeof is an example of ____________. |
A. | Ternary Operator |
B. | Binary Operator |
C. | Unary Operator |
D. | None of these |
Answer» D. None of these | |
82. |
Declare the following statement?"A pointer to an array of three chars". |
A. | char *ptr[3](); |
B. | char (*ptr)*[3]; |
C. | char (*ptr[3])(); |
D. | char (*ptr)[3]; |
Answer» E. | |
83. |
What do the following declaration signify?void *cmp(); |
A. | cmp is a pointer to an void type. |
B. | cmp is a void type pointer variable. |
C. | cmp is a function that return a void pointer. |
D. | cmp function returns nothing. |
Answer» D. cmp function returns nothing. | |
84. |
What is size of int in C ? |
A. | 2 bytes |
B. | 4 bytes |
C. | 8 bytes |
D. | Depends on the system/compiler |
Answer» E. | |
85. |
In expression i = g() + f(), first function called depends on |
A. | Compiler |
B. | Associativiy of () operator |
C. | Precedence of () and + operator |
D. | Left to write of the expression |
Answer» B. Associativiy of () operator | |
86. |
C programming language provides operations which deal directly with objects such as |
A. | strings and sets |
B. | lists and arrays |
C. | characters, integers, and floating point numbers |
D. | all of these |
Answer» D. all of these | |
87. |
Associativity of unary operator is from _________ to __________. |
A. | Right to Left |
B. | Left to Right |
C. | Top to bottom |
D. | None of the above |
Answer» B. Left to Right | |
88. |
What is the type of the below assignment expression if x is of type float, y is of type int? y = x + y; |
A. | int |
B. | float |
C. | there is no type for an assignment expression |
D. | double |
Answer» D. double | |
89. |
Which of the following comments about the ++ operator are correct ? |
A. | it is a unary operator |
B. | the operand can come before or after the operator |
C. | it cannot be applied to an expression and is ssociated from the right |
D. | All of these |
Answer» E. | |
90. |
What will be the output of the program in 16 bit platform ? |
A. | 2 |
B. | 4 |
C. | 8 |
D. | Linker Error |
Answer» E. | |
91. |
What will be output when you will execute following c code? |
A. | 4 2 1 |
B. | 8 4 4 |
C. | 8 4 2 |
D. | compiler dependent |
Answer» E. | |
92. |
If abc is the input, then the following program fragment results in |
A. | a syntax error |
B. | a fatal error |
C. | segmentation violation |
D. | printing of 3 |
Answer» E. | |
93. |
What is the output of the following 'C' program? |
A. | Undefined |
B. | 20 |
C. | Error |
D. | Garbage Value |
Answer» C. Error | |
94. |
If s and b are integers then purpose of the following program fragment is to b = s + b ; s = b - s ; b = b - s ; |
A. | transfer the contents of s to b |
B. | transfer the content of b to s |
C. | exchange (swap) the contents of s and b |
D. | negate the contents of s and b |
Answer» D. negate the contents of s and b | |
95. |
Which of the following are unary operators in C ? 1. ! 2. sizeof 3. ~ 4. && |
A. | 1 and 2 |
B. | 3 and 4 |
C. | 1, 2 and 3 |
D. | 1 and 3 |
Answer» D. 1 and 3 | |
96. |
Associativity of an operator are: |
A. | Right to Left |
B. | Left to Right |
C. | Random fashion |
D. | Both Right to Left and Left to Right |
Answer» E. | |
97. |
In C programming language, if the first and the second operands of operator + are of types int and float, respectively, the result will be of type |
A. | int |
B. | float |
C. | char |
D. | long int |
Answer» C. char | |
98. |
Value of c after the following expression (initialization a = 1, b = 2, c = 1): c += (-c) ? a : b; |
A. | Syntax Error |
B. | c = 1 |
C. | c = 2 |
D. | c = 3 |
Answer» D. c = 3 | |
99. |
Printing a character as an integer |
A. | results in the printing of a negative integer |
B. | always prints a positive integer |
C. | prints a value that is implementation dependent |
D. | none of these |
Answer» D. none of these | |
100. |
Range of double is -1.7e-38 to 1.7e+38. (in 16 bit platform - Turbo C under DOS) |
A. | True |
B. | False |
C. | May be True or False |
D. | Can't Say |
Answer» C. May be True or False | |