Quick Kit: 38 MCQs
All 38 multiple-choice questions from this kit, free and with no sign-up.
Warm-up · 19 questions
Q1. Which of the following is a valid variable name in C?
BeginnerAnswers and explanations are in the Veda app.
Q2. What will be the output of the following code? ```c int x = 5; int y = x++; printf("%d %d", x, y); ```
BeginnerAnswers and explanations are in the Veda app.
Q3. Which loop is guaranteed to execute its body at least once?
BeginnerAnswers and explanations are in the Veda app.
Q4. What does the following code print? ```c int arr[] = {10, 20, 30}; int *ptr = arr; printf("%d", *(ptr + 1)); ```
BeginnerAnswers and explanations are in the Veda app.
Q5. Which function is used to read a string including spaces from standard input?
BeginnerAnswers and explanations are in the Veda app.
Q6. What is the output of the following code? ```c int a = 10, b = 20; if (a = b) { printf("Equal"); } else { printf("Not Equal"); } ```
BeginnerAnswers and explanations are in the Veda app.
Q7. Which header file is required for using `malloc` and `free`?
BeginnerAnswers and explanations are in the Veda app.
Q8. What is the output of the following recursive function for `n = 5`? ```c int fact(int n) { if (n == 0) return 1; return n * fact(n - 1); } ```
BeginnerAnswers and explanations are in the Veda app.
Q9. Which of the following correctly declares a pointer to an integer?
BeginnerAnswers and explanations are in the Veda app.
Q10. In C, the `&&` operator returns true if at least one operand is true.
BeginnerAnswers and explanations are in the Veda app.
Q11. A string in C can be modified after it is created using a character array.
BeginnerAnswers and explanations are in the Veda app.
Q12. The ___ operator is used to access the members of a structure through a pointer.
BeginnerAnswers and explanations are in the Veda app.
Q13. A ___ loop is best suited when the number of iterations is known in advance.
BeginnerAnswers and explanations are in the Veda app.
Q14. What is a null pointer and why is it useful?
BeginnerAnswers and explanations are in the Veda app.
Q15. What is the purpose of the `break` statement in a `switch` statement?
BeginnerAnswers and explanations are in the Veda app.
Q16. What is an array in C and how are its elements accessed?
BeginnerAnswers and explanations are in the Veda app.
Q17. What is the output of `printf("%d", sizeof(char));` and why?
BeginnerAnswers and explanations are in the Veda app.
Q18. What is a structure in C and how do you access its members?
BeginnerAnswers and explanations are in the Veda app.
Q19. What is the difference between `getchar` and `putchar`?
BeginnerAnswers and explanations are in the Veda app.
Building up · 12 questions
Q20. Explain the difference between the prefix and postfix increment operators in C.
IntermediateAnswers and explanations are in the Veda app.
Q21. How does a `for` loop differ from a `while` loop in terms of structure and typical use cases?
IntermediateAnswers and explanations are in the Veda app.
Q22. Explain the concept of passing by value in C functions.
IntermediateAnswers and explanations are in the Veda app.
Q23. What is the difference between `fprintf` and `fscanf`?
IntermediateAnswers and explanations are in the Veda app.
Q24. Describe the difference between `calloc` and `malloc`.
IntermediateAnswers and explanations are in the Veda app.
Q25. How do you declare a function that takes an array as a parameter?
IntermediateAnswers and explanations are in the Veda app.
Q26. Explain the concept of recursion and provide a simple example.
IntermediateAnswers and explanations are in the Veda app.
Q27. Consider the following C code snippet: ```c int a = 5, b = 10; int result = a++ + --b; printf("%d %d %d", a, b, result); ``` What is the output?
IntermediateAnswers and explanations are in the Veda app.
Q28. Which of the following correctly describes the behavior of the `continue` statement inside a `for` loop?
IntermediateAnswers and explanations are in the Veda app.
Q29. What is the output of the following code? ```c #include <stdio.h> void swap(int x, int y) { int temp = x; x = y; y = temp; } int main() { int a = 3, b = 7; swap(a, b); printf("%d %d", a, b); return 0; } ```
IntermediateAnswers and explanations are in the Veda app.
Q30. Given the declaration `int arr[] = {2, 4, 6, 8};` and `int *p = arr;`, which expression correctly accesses the value `6`?
IntermediateAnswers and explanations are in the Veda app.
Q31. What is the output of the following code? ```c #include <stdio.h> int main() { int x = 0; if (x = 1) { printf("True"); } else { printf("False"); } return 0; } ```
IntermediateAnswers and explanations are in the Veda app.
Topper level · 7 questions
Q32. Explain the concept of pointer arithmetic with an example.
AdvancedAnswers and explanations are in the Veda app.
Q33. What is the purpose of the `const` keyword when used with a pointer?
AdvancedAnswers and explanations are in the Veda app.
Q34. Consider the following C code snippet: ```c #include <stdio.h> int main() { int a = 5, b = 10; int result = a++ + --b; printf("%d %d %d", a, b, result); return 0; } ``` What is the output?
AdvancedAnswers and explanations are in the Veda app.
Q35. Given the declaration `int arr[] = {2, 4, 6, 8};` and `int *p = arr;`, which expression correctly accesses the value `6`?
AdvancedAnswers and explanations are in the Veda app.
Q36. What is the output of the following code? ```c #include <stdio.h> void swap(int x, int y) { int temp = x; x = y; y = temp; } int main() { int a = 3, b = 7; swap(a, b); printf("%d %d", a, b); return 0; } ```
AdvancedAnswers and explanations are in the Veda app.
Q37. What is the output of the following code? ```c #include <stdio.h> int main() { int x = 0; if (x = 1) { printf("True"); } else { printf("False"); } return 0; } ```
AdvancedAnswers and explanations are in the Veda app.
Q38. Consider the following C code that attempts to read a string including spaces: ```c #include <stdio.h> int main() { char str[50]; printf("Enter a string: "); scanf("%s", str); printf("%s", str); return 0; } ``` If the user enters "Hello World", what will be printed?
AdvancedAnswers and explanations are in the Veda app.
Your notes can be a kit like these
Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free to start, in more than 40 languages.
- Chapter notes
- Flashcards
- Practice MCQs
- Scored tests
- Paper Solver
Get Veda free See what students get
Free to start · Android app and web · More than 40 languages