InterviewSolution
Saved Bookmarks
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Predict the output of below program:#include <stdio.h>int main(){printf("%c ", "GeeksQuiz"[5]);return 0;}(A) Compile-time error(B) Runtime error(C) Q(D) s |
| Answer» | |
| 2. |
Which of the following is true(A) gets() can read a string with newline characters but a normal scanf() with %s can not.(B) gets() can read a string with spaces but a normal scanf() with %s can not.(C) gets() can always replace scanf() without any additional code.(D) None of the above |
| Answer» None | |
| 3. |
Predict the output of following program?#include <stdio.h>int main(void){int x = printf("GeeksQuiz");printf("%d", x);return 0;}(A) GeeksQuiz9(B) GeeksQuiz10(C) GeeksQuizGeeksQuiz(D) GeeksQuiz1 |
| Answer» | |
| 4. |
Which of the following is true(A) gets() doesn’t do any array bound testing and should not be used.(B) fgets() should be used in place of gets() only for files, otherwise gets() is fine(C) gets() cannot read strings with spaces(D) None of the above |
| Answer» | |
| 5. |
#include<stdio.h>int main(){char *s = "Geeks Quiz";int n = 7;printf("%.*s", n, s);return 0;}(A) Geeks Quiz(B) Nothing is printed(C) Geeks Q(D) Geeks Qu |
| Answer» | |
| 6. |
What does the following C statement mean?scanf("%4s", str);(A) Read exactly 4 characters from console.(B) Read maximum 4 characters from console.(C) Read a string str in multiples of 4(D) Nothing |
| Answer» None | |
| 7. |
What is the return type of getchar()?(A) int(B) char(C) unsigned char(D) float |
| Answer» | |