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.
| 1. |
What is the purpose of function. |
| A. | flushes all streams and specified streams. |
| B. | flushes only specified stream. |
| C. | flushes input/output buffer. |
| D. | flushes file buffer. |
| Answer» B. flushes only specified stream. | |
| 2. |
Can you use the to display the output on the screen? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 3. |
What will the function do in Turbo C under DOS? |
| A. | returns a random number. |
| B. | returns a random number generator in the specified range. |
| C. | returns a random number generator with a random value based on time. |
| D. | return a random number with a given seed value. |
| Answer» D. return a random number with a given seed value. | |
| 4. |
is a structure suitably 'd in "stdio.h". |
| A. | True |
| B. | False |
| Answer» B. False | |
| 5. |
returns the current position of the pointer in a file stream. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 6. |
Data written into a file using can be read back using |
| A. | True |
| B. | False |
| Answer» C. | |
| 7. |
If the two strings are found to be unequal then returns difference between the first non-matching pair of characters. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 8. |
What will function 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. | |
| 9. |
Will the program outputs "IndiaBIX.com"? |
| A. | Yes |
| B. | No |
| Answer» C. | |
| 10. |
The function can convert an integer in decimal, octal or hexadecimal form to a string. |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 11. |
The prototypes of all standard library string functions are declared in the file . |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 12. |
or function can be used to convert a string like "436" in to integer. |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 13. |
What will the function do? |
| A. | Reposition the file pointer to a character reverse. |
| B. | Reposition the file pointer stream to end of file. |
| C. | Reposition the file pointer to begining of that line. |
| D. | Reposition the file pointer to begining of file. |
| Answer» E. | |
| 14. |
What is ? |
| A. | standard error |
| B. | standard error types |
| C. | standard error streams |
| D. | standard error definitions |
| Answer» D. standard error definitions | |
| 15. |
Does there any function exist to convert the or to a ? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 16. |
Point out the error in the following program._x000D_ #include_x000D_ #include_x000D_ _x000D_ int main()_x000D_ {_x000D_ char str1[] = "Learn through IndiaBIX\0.com", str2[120];_x000D_ char *p;_x000D_ p = (char*) memccpy(str2, str1, 'i', strlen(str1));_x000D_ *p = '\0';_x000D_ printf("%s", str2);_x000D_ return 0;_x000D_ } |
| 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. | |
| 17. |
What will be the output of the program?_x000D_ #include_x000D_ #include_x000D_ _x000D_ int main()_x000D_ {_x000D_ char dest[] = {97, 97, 0};_x000D_ char src[] = "aaa";_x000D_ int i;_x000D_ if((i = memcmp(dest, src, 2))==0)_x000D_ printf("Got it");_x000D_ else_x000D_ printf("Missed");_x000D_ return 0;_x000D_ } |
| A. | Missed |
| B. | Got it |
| C. | Error in memcmp statement |
| D. | None of above |
| Answer» C. Error in memcmp statement | |
| 18. |
What will be the output of the program?_x000D_ #include_x000D_ #include_x000D_ _x000D_ int main()_x000D_ {_x000D_ char *i = "55.555";_x000D_ int result1 = 10;_x000D_ float result2 = 11.111;_x000D_ result1 = result1+atoi(i);_x000D_ result2 = result2+atof(i);_x000D_ printf("%d, %f", result1, result2);_x000D_ return 0;_x000D_ } |
| A. | 55, 55.555 |
| B. | 66, 66.666600 |
| C. | 65, 66.666000 |
| D. | 55, 55 |
| Answer» D. 55, 55 | |
| 19. |
What will be the output of the program?_x000D_ #include_x000D_ #include_x000D_ _x000D_ int main()_x000D_ {_x000D_ float i = 2.5;_x000D_ printf("%f, %d", floor(i), ceil(i));_x000D_ return 0;_x000D_ } |
| A. | 2, 3 |
| B. | 2.000000, 3 |
| C. | 2.000000, 0 |
| D. | 2, 0 |
| Answer» D. 2, 0 | |
| 20. |
What will be the output of the program?_x000D_ #include_x000D_ _x000D_ int main()_x000D_ {_x000D_ int i;_x000D_ i = printf("How r u\n");_x000D_ i = printf("%d\n", i);_x000D_ printf("%d\n", i);_x000D_ return 0;_x000D_ } |
| A. | How r u72 |
| B. | How r u82 |
| C. | How r u11 |
| D. | Error: cannot assign printf to variable |
| Answer» C. How r u11 | |
| 21. |
What will be the output of the program?_x000D_ #include_x000D_ _x000D_ int main()_x000D_ {_x000D_ int i;_x000D_ char c;_x000D_ for(i=1; i<=5; i++)_x000D_ {_x000D_ scanf("%c", &c); /* given input is 'a' */_x000D_ printf("%c", c);_x000D_ ungetc(c, stdin);_x000D_ }_x000D_ return 0;_x000D_ } |
| A. | aaaa |
| B. | aaaaa |
| C. | Garbage value. |
| D. | Error in ungetc statement. |
| Answer» C. Garbage value. | |
| 22. |
When using atoi( ) with an apstring variable, |
| A. | all numbers within the string will be converted to integers. |
| B. | you must convert the apstring to a standard string by using .c_str( ). |
| C. | all alphabetic characters within the string will be counte |
| D. | all characters within the string will be converted to ASCII equivalents. |
| Answer» C. all alphabetic characters within the string will be counte | |
| 23. |
time_t is |
| A. | a data type |
| B. | a variable used to hold a number from the computer's internal clock. |
| C. | a header file. |
| D. | a built-in library function which will return a value from the internal clock. |
| Answer» B. a variable used to hold a number from the computer's internal clock. | |
| 24. |
The built-in library function ceil(x) requires the header file |
| A. | 1) |
| B. | 2) |
| C. | 3) |
| D. | 4) |
| Answer» B. 2) | |
| 25. |
void (*signal(int sig, void (*func)(int)))(int);If the value of func is SIG_IGN then _________ |
| A. | the signal will be ignored |
| B. | default handling for that signal will occur |
| C. | The signal() function will fail to execute |
| D. | the signal will be ignored |
| Answer» B. default handling for that signal will occur | |
| 26. |
void free(void *p) performs which of the following functions? |
| A. | returns pointer to allocated space for existing contents of p |
| B. | de-allocates space to which p points |
| C. | to abnormally terminate the program |
| D. | no such function defined in stdlib.h |
| Answer» C. to abnormally terminate the program | |
| 27. |
Correct code to turn assertions ON at various places throughout a source file is |
| A. | #undef NDEBUG #include |
| B. | #define NDEBUG #include |
| C. | #define NDEBUG #include |
| D. | #undef NDEBUG #include |
| Answer» B. #define NDEBUG #include | |
| 28. |
The C library function _____________function converts the wide character to its multibyte representation. |
| A. | mblen() |
| B. | mbtowc() |
| C. | wcstombs() |
| D. | wctomb() |
| Answer» E. | |
| 29. |
The calloc() function allocates space for an array of n objects, each of whose size is defined by size. Space is initialized to all bits zero. |
| A. | true |
| B. | false |
| Answer» B. false | |
| 30. |
Which of the given option is declared under the header file stdlib.h? |
| A. | SEEK_CUR |
| B. | SEEK_END |
| C. | CLOCKS_PER_SEC |
| D. | EXIT_SUCCESS |
| Answer» E. | |
| 31. |
void free(void *ptr) deallocates the memory previously allocated by a call to _______ ________ or _________ |
| A. | malloc,getenv,abort |
| B. | calloc,malloc,exit |
| C. | calloc,malloc,realloc |
| D. | exit,getenv,abort |
| Answer» D. exit,getenv,abort | |
| 32. |
The value of tm_isdst is ____ when DST( Daylight Savings Time) is in effect, ______ when DST is not in effect and ______ when the DST status is unknown. |
| A. | -1, 1, 0 |
| B. | 1, 0, -1 |
| C. | 0, 1, -1 |
| D. | 1, -1, 0 |
| Answer» C. 0, 1, -1 | |
| 33. |
Which function converts the wide-character string to a multibyte string? |
| A. | wcstombs() |
| B. | mbstowcs() |
| C. | mbtowc() |
| D. | mblen() |
| Answer» B. mbstowcs() | |
| 34. |
Which statement is true with respect to RAND_MAX? |
| A. | specifies value for status argument to exit indicating failure |
| B. | specifies value for status argument to exit indicating success |
| C. | specifies maximum value returned by rand() |
| D. | specifies maximum value returned by srand() |
| Answer» D. specifies maximum value returned by srand() | |
| 35. |
The following message is displayed in stderr.Assertion failed: expression, file filenum, line nmn |
| A. | true |
| B. | false |
| Answer» B. false | |
| 36. |
The minimum value of CHAR_BIT is equal to ________ |
| A. | 2 |
| B. | 4 |
| C. | 8 |
| D. | 16 |
| Answer» D. 16 | |
| 37. |
Which among the given function does not return a value? |
| A. | strtoul() |
| B. | strtol() |
| C. | rand() |
| D. | srand() |
| Answer» E. | |
| 38. |
Which function is called by macro assert to terminate the execution? |
| A. | exit() |
| B. | atexit() |
| C. | abort() |
| D. | no function called |
| Answer» D. no function called | |
| 39. |
Which of the following format specifiers is used to represent the name of the time zone? |
| A. | %A |
| B. | %B |
| C. | %H |
| D. | %Z |
| Answer» E. | |
| 40. |
The ldexp() function multiplies a floating-point number by an integral power of 2. |
| A. | true |
| B. | false |
| Answer» B. false | |
| 41. |
What is the name of the function that is used to convert multibyte character to wide character? |
| A. | mblen() |
| B. | mbtowc() |
| C. | mbstowcs() |
| D. | wcstombs() |
| Answer» C. mbstowcs() | |
| 42. |
The maximum value of a signed char is not the same as the maximum value of an unsigned char. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 43. |
setjmp takes a jmp_buf type and different other type variables as input. |
| A. | true |
| B. | false |
| Answer» C. | |
| 44. |
Select the multibyte character function defined under the header file stdlib.h. |
| A. | wctomb() |
| B. | mblen() |
| C. | mbtowc() |
| D. | all of the mentioned |
| Answer» E. | |
| 45. |
Which function returns a pseudo-random integer? |
| A. | srand() |
| B. | rand() |
| C. | malloc() |
| D. | alloc() |
| Answer» C. malloc() | |
| 46. |
Choose the right declaration of longjmp() function. |
| A. | void longjmp(jmp_buf environment, int value) |
| B. | void longjmp(setjmp environment, int value) |
| C. | void longjmp(int value, jmp_buf environment) |
| D. | void longjmp(int value, setjmp environment) |
| Answer» B. void longjmp(setjmp environment, int value) | |
| 47. |
The macros defined under the header file limits.h are not defined under any other header file. |
| A. | False |
| B. | True |
| Answer» C. | |
| 48. |
The number of bytes contained in the multibyte character pointed to by a character is ___________ |
| A. | getenv() |
| B. | bsearch() |
| C. | mblen() |
| D. | qsort() |
| Answer» D. qsort() | |
| 49. |
In the c library function void (*signal(int sig, void (*func)(int)))(int), which statement is true with respect to func? |
| A. | func is a pointer to the function |
| B. | func is pointer to sig |
| C. | func is a static variable |
| D. | func is a pointer that points to all type of data |
| Answer» B. func is pointer to sig | |
| 50. |
Which of the given function differs from the statement'errno is not neccessarily set on conversion error'? |
| A. | atof() |
| B. | atoi() |
| C. | atol() |
| D. | strtod() |
| Answer» E. | |