

MCQOPTIONS
Saved Bookmarks
This section includes 151 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.
101. |
What does the following function returns void *memmove(void *s1,const void s2, size_t n);? |
A. | returns the value of s1 |
B. | returns the value of s2 |
C. | doesn't return any value |
D. | returns the value of s1 and s2 |
Answer» B. returns the value of s2 | |
102. |
Which among the given options is the right explanation for the statement size_t strcspn(c, s)? |
A. | return length of prefix of s consisting of characters not in c |
B. | return length of prefix of s consisting of characters present in c |
C. | return length of prefix of c consisting of characters not in s |
D. | return length of prefix of c consisting of characters present in s |
Answer» D. return length of prefix of c consisting of characters present in s | |
103. |
What is the function of void *memset(s, c, n)? |
A. | places character s into first n characters of c, return c |
B. | places character c into first n characters of s, return s |
C. | places character s into first n characters of c, return s |
D. | places character c into first n character of s, return c |
Answer» C. places character s into first n characters of c, return s | |
104. |
What is the use of function char *strchr(ch, c)? |
A. | return pointer to first occurrence of ch in c or NULL if not present |
B. | return pointer to first occurrence of c in ch or NULL if not present |
C. | return pointer to first occurrence of ch in c or ignores if not present |
D. | return pointer to first occurrence of cin ch or ignores if not present |
Answer» C. return pointer to first occurrence of ch in c or ignores if not present | |
105. |
Functions whose names begin with “strn” |
A. | manipulates sequences of arbitrary characters |
B. | manipulates null-terminated sequences of characters |
C. | manipulates sequence of non – null characters. |
D. | returns a pointer to the token |
Answer» D. returns a pointer to the token | |
106. |
What will be the output of the program ?
#include
|
A. | Hello |
B. | HelloHello |
C. | No output |
D. | ello |
Answer» B. HelloHello | |
107. |
What will be the output of the program ?
#include
|
A. | Error |
B. | IndiaBIX |
C. | BIX |
D. | None of above |
Answer» D. None of above | |
108. |
What will be the output of the program ?
#include
|
A. | Unpredictable integer value |
B. | 0 |
C. | -1 |
D. | Error |
Answer» B. 0 | |
109. |
What will be the output of the program ?
#include
|
A. | Suresh, Siva, Sona, Baiju, Ritu |
B. | Suresh, Siva, Sona, Ritu, Baiju |
C. | Suresh, Siva, Baiju, Sona, Ritu |
D. | Suresh, Siva, Ritu, Sona, Baiju |
Answer» C. Suresh, Siva, Baiju, Sona, Ritu | |
110. |
What will be the output of the program ?
#include
|
A. | Error |
B. | d |
C. | e |
D. | abcdefgh |
Answer» D. abcdefgh | |
111. |
What will be the output of the program in 16-bit platform (Turbo C under DOS) ?
#include
|
A. | 8, 1, 4 |
B. | 4, 2, 8 |
C. | 4, 2, 4 |
D. | 10, 3, 4 |
Answer» C. 4, 2, 4 | |
112. |
If the size of pointer is 4 bytes then What will be the output of the program ?
#include
|
A. | 22, 4 |
B. | 25, 5 |
C. | 24, 5 |
D. | 20, 2 |
Answer» D. 20, 2 | |
113. |
What will be the output of the program ?
#include
|
A. | The sentence will get printed in same order as it entered |
B. | The sentence will get printed in reverse order |
C. | Half of the sentence will get printed |
D. | None of above |
Answer» C. Half of the sentence will get printed | |
114. |
What will be the output of the following program in 16 bit platform assuming that 1022 is memory address of the string "Hello1" (in Turbo C under DOS) ?
#include
|
A. | 1022 Hello2 |
B. | Hello1 1022 |
C. | Hello1 Hello2 |
D. | 1022 1022 |
Answer» B. Hello1 1022 | |
115. |
What will be the output of the program ?
#include
|
A. | t, t |
B. | k, k |
C. | n, k |
D. | m, f |
Answer» C. n, k | |
116. |
What will be the output of the program ?
#include
|
A. | The string is empty |
B. | The string is not empty |
C. | No output |
D. | 0 |
Answer» C. No output | |
117. |
What will be the output of the program ?
#include
|
A. | Kagpur, Kanpur |
B. | Nagpur, Kanpur |
C. | Kagpur, anpur |
D. | Error |
Answer» E. | |
118. |
What will be the output of the program (Turbo C in 16 bit platform DOS) ?
#include
|
A. | IndiaBIX India |
B. | IndiaBIX IndiaBIX |
C. | India India |
D. | Error |
Answer» C. India India | |
119. |
What will be the output of the program ?
#include
|
A. | 10 |
B. | 6 |
C. | 5 |
D. | 11 |
Answer» D. 11 | |
120. |
What will be the output of the program ?
#include
|
A. | India BIX |
B. | BIX India |
C. | India India |
D. | BIX BIX |
Answer» C. India India | |
121. |
What will be the output of the program ?
#include
|
A. | hhe! |
B. | he c |
C. | The c |
D. | Hhec |
Answer» B. he c | |
122. |
What will be the output of the program ?
#include
|
A. | Error |
B. | India BIX |
C. | India |
D. | BIX |
Answer» D. BIX | |
123. |
What will be the output of the program ?
#include
|
A. | The string is not empty |
B. | The string is empty |
C. | No output |
D. | 0 |
Answer» C. No output | |
124. |
If the size of pointer is 32 bits What will be the output of the program ?
#include
|
A. | 10, 22, 2 |
B. | 10, 41, 2 |
C. | 11, 41, 1 |
D. | 12, 22, 2 |
Answer» D. 12, 22, 2 | |
125. |
What will be the output of the program ?
#include
|
A. | 8 |
B. | 0 |
C. | 16 |
D. | Error |
Answer» C. 16 | |
126. |
What will be the output of the program ?
#include
|
A. | 10 |
B. | 6 |
C. | 5 |
D. | 11 |
Answer» E. | |
127. |
What will be the output of the program ?
#include
|
A. | Equal |
B. | Unequal |
C. | Error |
D. | None of above |
Answer» C. Error | |
128. |
What will be the output of the program ?
#include
|
A. | Error |
B. | IndiaBIX |
C. | Cannot predict |
D. | None of above |
Answer» D. None of above | |
129. |
What will be the output of the program ?
#include
|
A. | Error |
B. | IndiaBIX |
C. | Base address of str |
D. | No output |
Answer» B. IndiaBIX | |
130. |
What will be the output of the program ?
#include
|
A. | Garbage value |
B. | Error |
C. | No output |
D. | diaBIX |
Answer» B. Error | |
131. |
Which of the following statements are correct about the below declarations? char *p = "Sanjay";char a[] = "Sanjay"; 1: There is no difference in the declarations and both serve the same purpose. 2: p is a non-const pointer pointing to a non-const string, whereas a is a const pointer pointing to a non-const pointer. 3: The pointer p can be modified to point to another string, whereas the individual characters within array a can be changed. 4: In both cases the '\0' will be added at the end of the string "Sanjay". |
A. | 1, 2 |
B. | 2, 3, 4 |
C. | 3, 4 |
D. | 2, 3 |
Answer» C. 3, 4 | |
132. |
What will be the output of the program ?
#include
|
A. | Good Morning |
B. | Good |
C. | M |
D. | Morning |
Answer» E. | |
133. |
Which of the following function is correct that finds the length of a string? |
A. | int xstrlen(char *s) { int length=0; while(*s!='\0') { length++; s++; } return (length); } |
B. | int xstrlen(char s) { int length=0; while(*s!='\0') length++; s++; return (length); } |
C. | int xstrlen(char *s) { int length=0; while(*s!='\0') length++; return (length); } |
D. | int xstrlen(char *s) { int length=0; while(*s!='\0') s++; return (length); } |
Answer» B. int xstrlen(char s) { int length=0; while(*s!='\0') length++; s++; return (length); } | |
134. |
What will be the output of the program ?
#include
|
A. | BIX |
B. | India |
C. | India BIX |
D. | India\0BIX |
Answer» C. India BIX | |
135. |
Is there any difference between the two statements? char *ch = "IndiaBIX";char ch[] = "IndiaBIX"; |
A. | Yes |
B. | No |
Answer» B. No | |
136. |
If char=1, int=4, and float=4 bytes size, What will be the output of the program ?
#include
|
A. | 1, 2, 4 |
B. | 1, 4, 4 |
C. | 2, 2, 4 |
D. | 2, 4, 8 |
Answer» C. 2, 2, 4 | |
137. |
What will be the output of the program ?
#include
|
A. | A |
B. | a |
C. | c |
D. | 65 |
Answer» B. a | |
138. |
Which of the following statements are correct ? 1: A string is a collection of characters terminated by '\0'. 2: The format specifier %s is used to print a string. 3: The length of the string can be obtained by strlen(). 4: The pointer CANNOT work on string. |
A. | 1, 2 |
B. | 1, 2, 3 |
C. | 2, 4 |
D. | 3, 4 |
Answer» C. 2, 4 | |
139. |
What will be the output of the program ?
#include
|
A. | 6 |
B. | 12 |
C. | 7 |
D. | 2 |
Answer» B. 12 | |
140. |
For the following statements will arr[3] and ptr[3] fetch the same character? char arr[] = "IndiaBIX";char *ptr = "IndiaBIX"; |
A. | Yes |
B. | No |
Answer» B. No | |
141. |
What will be the output of the program ?
#include
|
A. | 0 |
B. | 1 |
C. | 2 |
D. | 4 |
Answer» B. 1 | |
142. |
What will be the output of the program in Turbo C?
#include
|
A. | India BIX |
B. | BIX |
C. | India |
D. | Error |
Answer» E. | |
143. |
What will be the output of the program If characters 'a', 'b' and 'c' enter are supplied as input?
#include
|
A. | abc abc |
B. | bca |
C. | Infinite loop |
D. | cba |
Answer» E. | |
144. |
What will be the output of the program ?
#include
|
A. | IndiaBIXHello |
B. | Address of "Hello" and "IndiaBIX" |
C. | HelloIndiaBIX |
D. | IelloHndiaBIX |
Answer» D. IelloHndiaBIX | |
145. |
Which of the following statements are correct about the program below?
#include
|
A. | The code converts a string in to an integer |
B. | The code converts lower case character to upper case |
C. | The code converts upper case character to lower case |
D. | Error in code |
Answer» C. The code converts upper case character to lower case | |
146. |
Will the program compile successfully?
#include
|
A. | Yes |
B. | No |
C. | Yes |
D. | No |
Answer» C. Yes | |
147. |
Which of the following function is more appropriate for reading in a multi-word string? |
A. | printf(); |
B. | scanf(); |
C. | gets(); |
D. | puts(); |
Answer» D. puts(); | |
148. |
How will you print \n on the screen? |
A. | printf("\n"); |
B. | echo "\\n"; |
C. | printf('\n'); |
D. | printf("\\n"); |
Answer» E. | |
149. |
If the two strings are identical, then strcmp() function returns |
A. | -1 |
B. | 1 |
C. | 0 |
D. | Yes |
Answer» D. Yes | |
150. |
What will be the output of the program ?
#include
|
A. | Hello |
B. | World |
C. | Hello World |
D. | WorldHello |
Answer» D. WorldHello | |