Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 3 subjective questions Control Statements and Decision Making

CAP1008 — C Programming 20 questions with model answers. Write yours first, then compare.

Read the notes Practice MCQs
  1. Question 1 of 20

    What are control statements in C? Explain the need for control statements in a program.

  2. Question 2 of 20

    Explain the simple if statement in C with its syntax, flowchart description, and an example.

  3. Question 3 of 20

    Explain the if-else statement with syntax and a program to check whether a number is even or odd.

  4. Question 4 of 20

    What is a nested if statement? Write a program using nested if to find the largest of three numbers.

  5. Question 5 of 20

    Explain the else-if ladder with syntax and write a program to assign grades based on marks.

  6. Question 6 of 20

    Explain the switch statement in C in detail with its syntax, rules, and an example.

  7. Question 7 of 20

    Distinguish between the if-else ladder and the switch statement.

  8. Question 8 of 20

    What is a loop? Explain the three essential elements of any loop and classify the loops available in C.

  9. Question 9 of 20

    Explain the while loop with syntax, working, and a program to print the sum of first natural numbers.

  10. Question 10 of 20

    Explain the do-while loop and write a program to display a menu that repeats until the user chooses to exit.

  11. Question 11 of 20

    Compare the while loop and the do-while loop with a suitable example of each.

  12. Question 12 of 20

    Explain the for loop in detail with syntax, working, and a program to print a multiplication table.

  13. Question 13 of 20

    What is a nested loop? Write a program to print the following pattern using nested for loops:

    *

    • *
      • *

  14. Question 14 of 20

    Explain the break statement and the continue statement in C with examples. How do they differ?

  15. Question 15 of 20

    Explain the goto statement in C with its syntax and an example. Why is its use generally discouraged?

  16. Question 16 of 20

    Write a C program to check whether a given number is prime or not, and explain the logic used.

  17. Question 17 of 20

    Describe the concept of an infinite loop. How can it be created intentionally and unintentionally? Give examples of each.

  18. Question 18 of 20

    Write a C program using a loop to reverse a given integer number and check whether it is a palindrome.

  19. Question 19 of 20

    Explain the different forms of the if statement in C (simple if, if-else, nested if, else-if ladder) with a brief description of when to use each.

  20. Question 20 of 20

    What is meant by the fall-through behavior in a switch statement? Explain with an example and describe how it can be both a problem and a useful feature.

That's unit 3

Long answers stick best when they're tested again soon. Run the MCQs on this unit, then come back to the questions you found hardest.