C Questions March 18, 2023 | No Comments 0 votes, 0 avg 86 123456789101112131415 C Questions 1 / 15 1. What is output of below program? int main() { int i,j,count; count=0; for(i=0; i<5; i++); { for(j=0;j<5;j++); { count++; } } printf("%d",count); return 0; } A. 55 B. 54 C. 1 D. o 2 / 15 2. What will be the output of the following C code? #include int main() { printf("%d ", 1); goto l1; printf("%d ", 2); l1:goto l2; printf("%d ", 3); l2:printf("%d ", 4); } A. 1 4 B. compilation error C. 1 2 4 D. 1 3 4 3 / 15 3. Which C keyword is used to extend the visibility of variables? A. extend B. extends C. extern D. auto 4 / 15 4. Which of the following is true about return type of functions in C? A. Functions can return any type B. Functions can return any type except array and functions C. Functions can return any type except array, functions and union D. Functions can return any type except array, functions, function pointer and union 5 / 15 5. What will be the output of the following C code? #include int main() { int x = 0; if (x == 1) if (x == 0) printf("inside ifn"); else printf("inside else ifn"); else printf("inside elsen"); } A. inside if B. inside else if C. inside else D. compile time error 6 / 15 6. Which of the following is an exit controlled loop? A. While loop B. for loop C. Do-while loop D. none of the above 7 / 15 7. scanf() is a predefined function in______header file. A. stdlib. h B. ctype. h C. stdio. h D. stdarg. h 8 / 15 8. Which of the following is true for the static variable? A. It can be called from another function B. It exists even after the function ends C. It can be modified in another function by sending it as a parameter D. All of the mentioned 9 / 15 9. What is the default return type if it is not specified in function definition? A. void B. int C. double D. short int 10 / 15 10. What does the following program print? #include void f(int *p, int *q) { p = q; *p = 2; } int i = 0, j = 1; int main() { f(&i, &j); printf("%d %d n", i, j); getchar(); return 0; } A. 2 2 B. 2 1 C. 0 1 D. 0 2 11 / 15 11. Which option should be selected to work the following C expression? string p = "HELLO"; A. typedef char [] string; B. typedef char *string; C. typedef char [] string; and typedef char *string; D. Such expression cannot be generated in C 12 / 15 12. Global variables are ____________ A. Internal B. External C. Both Internal and External D. None of the mentioned 13 / 15 13. What will be the output of the following C code if following commands are used to run (considering myfile exists)? A. Compile time error (after first command) B. d in the myfile file C. d on the screen D. Undefined behaviour 14 / 15 14. What is output of below program? int main() { int i,j; for(i = 0,j=0;i<5;i++) { printf("%d%d--",i,j); } return 0; } A. 0--01--12--23--34-- B. 00--10--20--30--40-- C. Compilation Error D. 00--01--02--03--04-- 15 / 15 15. What is the format identifier for “static a = 20.5;”? A. %s B. %d C. %f D. Illegal declaration due to absence of data type Your score is The average score is 30% LinkedIn Facebook Twitter VKontakte 0% Restart quiz Questions, Quiz