MCQOPTIONS
Saved Bookmarks
This section includes 109 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. |
Select the macro that affects the information provided by localeconv function. |
| A. | LC_ALL |
| B. | LC_COLLATE |
| C. | LC_NUMERIC |
| D. | LC_CTYPE |
| Answer» D. LC_CTYPE | |
| 52. |
What is returned by the function localeconv()? |
| A. | current location value |
| B. | past location value |
| C. | pointer to the last location |
| D. | pointer to the current location |
| Answer» E. | |
| 53. |
sqrt(x) function is not faster than the apparent equivalent pow(x,0.5). |
| A. | true |
| B. | false |
| Answer» C. | |
| 54. |
The macro which is used to find the maximum value of an unsigned integer is _________ |
| A. | UNINT_MAX |
| B. | UNSINT_MAX |
| C. | UINT_MAX |
| D. | UNIT_MAX |
| Answer» D. UNIT_MAX | |
| 55. |
What error occurs if an input argument is outside the domain over which the mathematical function is defined? |
| A. | domain error |
| B. | range error |
| C. | no error |
| D. | domain and range error |
| Answer» B. range error | |
| 56. |
Which of the following macros is defined under the header limits.h? |
| A. | FLT_ROUNDS |
| B. | USHRT_MAX |
| C. | DBL_MAX |
| D. | DECIMAL_DIG |
| Answer» C. DBL_MAX | |
| 57. |
mblen() function returns 0,if a null wide character was recognized. It returns -1 if an invalid multi-byte sequence was encountered. |
| A. | true |
| B. | false |
| Answer» B. false | |
| 58. |
The macro definition of INT_MIN is ____________ |
| A. | -INT_MAX – 1 |
| B. | INT_MAX – 1 |
| C. | -INT_MAX + 1 |
| D. | INT_MAX + 1 |
| Answer» B. INT_MAX – 1 | |
| 59. |
A type whose alignment requirement is at least as large as that of every data type: |
| A. | max_align_t |
| B. | ptrdiff_t |
| C. | size_t |
| D. | nULL |
| Answer» E. | |
| 60. |
Which function is used to recombine the fraction and exponent parts of a floating-point value after you have worked on them separately? |
| A. | frexp() |
| B. | exp() |
| C. | modf() |
| D. | Idexp() |
| Answer» E. | |
| 61. |
Which of the following functions returns a pointer to a string representing the date and time stored in a structure? |
| A. | ctime() |
| B. | time() |
| C. | asctime() |
| D. | localtime() |
| Answer» D. localtime() | |
| 62. |
Which macro can be used to detect and report exceptional conditions? |
| A. | extern |
| B. | edom |
| C. | assert |
| D. | lbdl_min 1e-37 |
| Answer» D. lbdl_min 1e-37 | |
| 63. |
Which of the following library functions returns the time in UTC (Greenwich mean time) format? |
| A. | localtime() |
| B. | gettime() |
| C. | gmtime() |
| D. | settime() |
| Answer» D. settime() | |
| 64. |
Which of the following header declares mathematical functions and macros? |
| A. | math.h |
| B. | assert.h |
| C. | stdmat. h |
| D. | stdio. h |
| Answer» B. assert.h | |
| 65. |
The macro offset expands to a constant of type __________________ |
| A. | size_t |
| B. | print_t |
| C. | ptrdiff_t |
| D. | nULL |
| Answer» B. print_t | |
| 66. |
double______(double x, double y) computes the floating-point remainder of x/y. |
| A. | modf |
| B. | fmod |
| C. | ceil |
| D. | floor |
| Answer» C. ceil | |
| 67. |
What are the contents of the register? |
| A. | sp, fp only |
| B. | sp only |
| C. | fp, pc only |
| D. | sp, fp, pc |
| Answer» E. | |
| 68. |
When we use multiple alignas specifiers in the same declaration, the ____________ one is used. |
| A. | first |
| B. | strictest |
| C. | last |
| D. | middle |
| Answer» C. last | |
| 69. |
Initial seed is ________ for the function srand(unsigned int seed). |
| A. | 0 |
| B. | 1 |
| C. | 0 |
| D. | 1 |
| Answer» C. 0 | |
| 70. |
Which header file should be included if a function has to be defined such that it can accept variable number of arguments? |
| A. | stdlib.h |
| B. | stdarg.h |
| C. | assert.h |
| D. | setjmp.h |
| Answer» C. assert.h | |
| 71. |
A domain error occurs if x is negative and y is not an integral value for the function pow(double x, double y). |
| A. | true |
| B. | false |
| Answer» B. false | |
| 72. |
Which of the following format specifiers is used to represent the hours in the 24 hour clock (0-23) format? |
| A. | %I |
| B. | %H |
| C. | %i |
| D. | %h |
| Answer» C. %i | |
| 73. |
The value returned by the library function mktime(), on failure is: |
| A. | -1 |
| B. | 0 |
| C. | 1 |
| D. | -2 |
| Answer» B. 0 | |
| 74. |
To find the maximum value of an object of type unsigned long long int, we use the macro _________ |
| A. | ULINT_MAX |
| B. | ULLINT_MAX |
| C. | ULONG_MAX |
| D. | ULLONG_MAX |
| Answer» E. | |
| 75. |
Which of the given function is a library function under the header math.h? |
| A. | log10() |
| B. | log20() |
| C. | log30() |
| D. | log50() |
| Answer» B. log20() | |
| 76. |
The header file setjmp.h is used to |
| A. | set location specific information |
| B. | control low-level calls and returns to and from functions |
| C. | handle signals reported during a program's execution |
| D. | manipulate strings (character arrays) |
| Answer» C. handle signals reported during a program's execution | |
| 77. |
Which function returns the arc sine in the range [-pi/2, +pi/2] radians? |
| A. | arcsin() |
| B. | asin() |
| C. | sin() |
| D. | asine() |
| Answer» C. sin() | |
| 78. |
The mbstowcs() function is used to return the number of array elements modified, not including a terminating zero code, if any. |
| A. | true |
| B. | false |
| Answer» B. false | |
| 79. |
MB_CUR_MAX is not defined in stdlib.h. |
| A. | true |
| B. | false |
| Answer» C. | |
| 80. |
The header file assert.h of the C Standard Library defines ________macro. |
| A. | stderr |
| B. | stdarg |
| C. | setjmp |
| D. | assert |
| Answer» E. | |
| 81. |
The purpose of the function ctime() is that ___________ |
| A. | it returns a string representing the local time |
| B. | it returns a void string |
| C. | it returns a string representing the time in UTC format |
| D. | it returns a string representing the time stored in a structure |
| Answer» B. it returns a void string | |
| 82. |
The library function clock() returns the number of _________ elapsed since the start of the program. |
| A. | minutes |
| B. | clock ticks |
| C. | milli-seconds |
| D. | micro-seconds |
| Answer» C. milli-seconds | |
| 83. |
The pointer used in the mblen() function points to the _________ |
| A. | first byte of multibyte character |
| B. | last byte of multibyte character |
| C. | middle byte of multibyte character |
| D. | no pointer is used in mblen function |
| Answer» B. last byte of multibyte character | |
| 84. |
What will function gcvt() do? |
| A. | Convert vector to integer value |
| B. | Convert floating-point number to a string |
| C. | Convert 2D array in to 1D array. |
| D. | Covert multi Dimensional array to 1D array |
| Answer» C. Convert 2D array in to 1D array. | |
| 85. |
What will be the output of the program? #include int main() { int i; char c; for(i=1; i |
| A. | aaaa |
| B. | aaaaa |
| C. | Garbage value. |
| D. | Error in ungetc statement. |
| Answer» C. Garbage value. | |
| 86. |
If the two strings are found to be unequal then strcmp returns difference between the first non-matching pair of characters. |
| A. | 1 |
| B. | |
| Answer» B. | |
| 87. |
What will be the output of the program? #include #include int main() { char *i = "55.555"; int result1 = 10; float result2 = 11.111; result1 = result1+atoi(i); result2 = result2+atof(i); printf("%d, %f", result1, result2); return 0; } |
| A. | 55, 55.555 |
| B. | 66, 66.666600 |
| C. | 65, 66.666000 |
| D. | 55, 55 |
| Answer» D. 55, 55 | |
| 88. |
FILE is a structure suitably typedef'd in "stdio.h". |
| A. | 1 |
| B. | |
| Answer» B. | |
| 89. |
Will the program outputs "IndiaBIX.com"? #include #include int main() { char str1[] = "IndiaBIX.com"; char str2[20]; strncpy(str2, str1, 8); printf("%s", str2); return 0; } |
| A. | Yes |
| B. | No |
| Answer» C. | |
| 90. |
Can you use the fprintf() to display the output on the screen? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 91. |
ftell() returns the current position of the pointer in a file stream. |
| A. | 1 |
| B. | |
| Answer» B. | |
| 92. |
Point out the error in the following program. #include int main() { char str[] = "IndiaBIX"; printf("%.#s %2s", str, str); return 0; } |
| A. | Error: in Array declaration |
| B. | Error: printf statement |
| C. | Error: unspecified character in printf |
| D. | No error |
| Answer» E. | |
| 93. |
What will be the output of the program? #include #include int main() { char dest[] = {97, 97, 0}; char src[] = "aaa"; int i; if((i = memcmp(dest, src, 2))==0) printf("Got it"); else printf("Missed"); return 0; } |
| A. | Missed |
| B. | Got it |
| C. | Error in memcmp statement |
| D. | None of above |
| Answer» C. Error in memcmp statement | |
| 94. |
The prototypes of all standard library string functions are declared in the file string.h. |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 95. |
What will be the output of the program? #include #include int main() { float i = 2.5; printf("%f, %d", floor(i), ceil(i)); return 0; } |
| A. | 2, 3 |
| B. | 2.000000, 3 |
| C. | 2.000000, 0 |
| D. | 2, 0 |
| Answer» D. 2, 0 | |
| 96. |
Data written into a file using fwrite() can be read back using fscanf() |
| A. | 1 |
| B. | |
| Answer» C. | |
| 97. |
Point out the error in the following program. #include #include int main() { char str1[] = "Learn through IndiaBIX\0.com", str2[120]; char *p; p = (char*) memccpy(str2, str1, 'i', strlen(str1)); *p = '\0'; printf("%s", str2); return 0; } |
| A. | Error: in memccpy statement |
| B. | Error: invalid pointer conversion |
| C. | Error: invalid variable declaration |
| D. | No error and prints "Learn through Indi" |
| Answer» E. | |
| 98. |
What will be the output of the program? #include int main() { int i; i = scanf("%d %d", &i, &i); printf("%d\n", i); return 0; } |
| A. | 1 |
| B. | 2 |
| C. | Garbage value |
| D. | Error: cannot assign scanf to variable |
| Answer» C. Garbage value | |
| 99. |
What will be the output of the program? #include int main() { int i; char c; for(i=1; i |
| A. | bbbb |
| B. | bbbbb |
| C. | b |
| D. | Error in ungetc statement. |
| Answer» D. Error in ungetc statement. | |
| 100. |
scanf() or atoi() function can be used to convert a string like "436" in to integer. |
| A. | Yes |
| B. | No |
| Answer» B. No | |