C Quiz to Test Your Knowledge
C programming language offers various features and functionalities to the programmers. It has various important topics which you must know to improve your coding skills. To help you to get better at C programming, we prepared a quiz that focused on the advanced concepts and topics of the C programming language. Let’s start!!!
0 of 50 Questions completed Questions: You have already completed the quiz before. Hence you can not start it again. Quiz is loading… You must sign in or sign up to start the quiz. You must first complete the following: 0 of 50 Questions answered correctly Your time: Time has elapsed You have reached 0 of 0 point(s), (0) Earned Point(s): 0 of 0, (0) What will be the output of the following program? int main() { int x = 0; while (x <= 5) { printf(“%d”, x); if (x > 4) goto func1; x++; } getchar(); return 0; } void foo() { func1: printf(“Tech”); } What is the output of the following program? #include <stdio.h> int main() { char string[] = “DoNotRush!”; char *s1 = string, *s2 = string; int x; for(x = 0; x < 2; x++) { printf(” %c “, *string); ++s1; } for(x = 0; x < 3; x++) { printf(” %c “, *s2); ++s2; } return 0; } Which string function should you use to split strings into a series of tokens in C? What is the output of the following program? #include <stdio.h> void func(char **ptr) { } int main(int argc, char **argv) { func(argv); getchar(); return 0; } What is the output of the following program? #include <stdio.h> int func(int i) { if(i%2) return (i–); else return func(func(i+1)); } int main() { int i; i = func(102); printf(“%d”,i); } What is the output of the following program? #include<stdio.h> int main() { static int zero=3; if(–zero){ main(); printf(“%d*0”,zero); } } In C, when you declare two or more functions as the same name but different parameters then what is it called? What is the output of the following program? # include <stdio.h> int main() { int a=0; for(a=0; a<20; a++) { switch(a) { case 0: a+=10; case 1: a+=21; case 5: a+=4; default: a-=1; break; } printf(“%d “, a); } return 0; } What will be the result of the below expression? strcmp(‘Tech’,’TECH’); What is the output of the following program? #include <stdio.h> int main() { if (remove(“Testing.txt”) != 0) perror(“An error”); else puts(“A Success!”); return 0; } What is the output of the following program? #include <stdio.h> int main() { int value = 21 << 1 << 21 >> 16 << 4; printf(“%d”, value); return 0; } What is the output of the following program? #include <stdio.h> int main(void) { int val; int data = 12; val = 42 || –data; printf(“%d %d”, val, data); return 0; } What is the output of the following program? #include<stdio.h> struct Tech { int val; struct Tech next_one; }; int main() { struct Tech data; data.val = 25; data.next_one = data; printf(“%d”, data.next_one.val); return 0; } Which command will help you to interchange one text into another? What is the use of the function srand()? Instead of the printf(), which function do you use to print the output from the following? What is the output of the following program? #include<stdio.h> int main() { int data = 0121; printf(“%d”, data); return 0; } What is the output of the following program? #include <stdio.h> #define SIZE 20 int main() { int area = SIZE*SIZE; printf(“%d”, area); return 0; } What is the output of the following program? #include <stdio.h> int main() { int data; for (data = 1; data <= 6; data++) { printf(“HI”); if (data == 4) continue; } return (0); } What is the use of a break statement in C? What is the output of the following program? #include <stdio.h> int main() { int val = 20; float val1; printf(“%d “, sizeof(++val – val1)); printf(“%d “, ++val); return 0; } What is the output of the below program? #include <stdio.h> int main() { static int x = 5; int y = 10; { int x = 10; x++; y–; } printf(“%d %d”, x, y); return 0; } What is the output of the following program? #include<stdio.h> int main(){ char ch = 0; int x = 1; printf(“%d”, sizeof(x) == sizeof(ch+x)); return 0; } What is the output of the following program? #include <stdio.h> int main() { char a[] = “Quiz in C”; printf(“%s”, a+2); return 0; } What is the number of tokens in the below statement? printf(“a = %d, &a = %x, x=%d”, a,&a,x); What will be the output of the following program? #include <stdio.h> #include <stdlib.h> int main() { for (int j=5; j>0; j-=2 ) { printf(“%d”, j+1); } return 0; } What is the output of the following program? #include<stdio.h> int main() { for(int i=0;i<3;i++){ printf(“#”); for(int j=1;j<1;j++){ printf(“*”); } } return 0; } What is the output of the following program? #include<stdio.h> int main() { struct {int data;} val = {data = 2}; printf(“%d”,val.data); return 0; } What does the below statement do? scanf(“%2s”, str); What is the output of the following program? #include<stdio.h> int main() { char *str = “Just a Quiz”; int num = 5; printf(“%.*s”, num, str); return 0; } What is the output of the following program? #include<stdio.h> struct st { int x=1021; }; int main() { printf(“%d”, sizeof(struct st)); return 0; } From below, which operator do you use to access the structure variables? What is the output of the following program? #include <stdio.h> #if X == 2 #define Y 4 #else #define Y -1 #endif int main() { printf(“%d”, Y); return 0; } Can you guess the output of the following? # include <stdio.h> # define gets “Hi There” int main() { printf(gets); return 0; } From below, which function is not safe to use if you want to read from the console? What is the output of the following code? #include<stdio.h> #define f(a,b) a##b int main() { int var1 = 25; printf(“%d”, f(var,1)); return 0; } What is the output of the following program? #include <stdio.h> int main() { int i = 5; printf(“%d %d %d”, i/2, i–, ++i); return 0; } Which of the following statements is correct in C? Which of the following statements is correct for the return type of function? Which of the following methods do C support? What is the output of the following program? #include <stdio.h> int main() { int x = 58; int * ptr = &x; –(*ptr); ++(*ptr); printf(“%d”, x); return 0; } Can you guess the output of the below program? for(;;){ printf(“Hello!”); } What is the right way to include your own header file in C? What will be the output of the following program? #include <stdio.h> int func(int a, int b, int c) { return a + b – c; } void main() { int (*ptr)(int, int, int); ptr = &func; printf(“%d”,(*ptr)(4, 6, -5)); } What is the output of the below program? #include<stdio.h> int main() { for(int i=0;i<1;i++){ printf(“H”); for(int j=1;j<2;j++){ printf(“i,”); for(int k=1;k<2;k++){ printf(” How are you?”); } } } return 0; } What is the use of mem functions in C? Under the header file math.h, if you declare a function named sqrt(-x) then what will it return? If you want to print the time in UTC format then which function should you use? What is the output of the following program? #include<stdio.h> #include<stdlib.h> int main() { int a=20, b=10; printf(“%d”, a+(~b)%3); return 0; } Which preprocessor directive should you use when you want to give additional info to the compiler? Quiz Summary
Information
Results
Results
0 Essay(s) Pending (Possible Point(s): 0) Categories
1. Question
2. Question
3. Question
4. Question
5. Question
6. Question
7. Question
8. Question
9. Question
10. Question
11. Question
12. Question
13. Question
14. Question
15. Question
16. Question
17. Question
18. Question
19. Question
20. Question
21. Question
22. Question
23. Question
24. Question
25. Question
26. Question
27. Question
28. Question
29. Question
30. Question
31. Question
32. Question
33. Question
34. Question
35. Question
36. Question
37. Question
38. Question
39. Question
40. Question
41. Question
42. Question
43. Question
44. Question
45. Question
46. Question
47. Question
48. Question
49. Question
50. Question
Summary
In this tutorial, we discussed some questions from the important topics of C programming. These are some advanced level types of C Quiz questions. So, you will require greater understanding of the C programming language. This tutorial will help you to improve and test your knowledge in C programming.
If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google
good and very helpful but some questions are having error in that
Nice questions