Skip to content

Structured Programming Lab

CIS · Quiz · Spring 26

Paper 1 of 2Section A · Batch 24 · Md Shahinur Rahman (স জি ব) (1)Switch

Section A · Batch 24

Paper 1 of 2

This browser can’t show the PDF here

Open it, and your phone’s PDF viewer takes it, or download it.

Read the questions as text

Read off the PDF by AI, so it may have mistakes. The PDF is the original.

Quiz: 03 (Set A) - Spring 2026 - Course: Structured Programming also set B Student Name: __________________________ Student ID: __________________________ Q1. [7 Marks] What is the difference between an "entry-controlled" loop and an "exit-controlled" loop? Give one example of a real-life coding situation where a entry-controlled loop is the best choice. Write a C program that takes a large positive integer from the user (for example, 245) and calculates the sum of its individual digits (2 + 4 + 5 = 11). Print the final sum. Q2. [8 Marks] What makes a loop run forever? Write a small example of a while loop that runs forever by mistake, and explain what is missing to fix it. Write a C program that acts as a continuous calculator. It should repeatedly ask the user to enter a number and add each number to a running total. The program must stop asking for numbers the exact moment the user enters 0, and then print the final total. Q1. [7 Marks] A for loop is made up of three main parts. Briefly explain the specific job of each part. What happens if you forget to include the Update part? Write a C program that asks the user to enter a single number, and then prints the complete multiplication table for that number from 1 up to 10. For example, if the user enters 5, it should print 5 x 1 = 5, 5 x 2 = 10, and so on. Q2. [8 Marks] Imagine you are writing a while loop to find the sum of all digits in a number. Why is a while loop a better choice for this specific problem than a for loop? Write a C program for an ATM login system. The correct PIN is 1234. The program should repeatedly ask the user to enter their PIN. If they enter the correct PIN, print "Access Granted!" and stop. If they guess incorrectly 3 times in a row, print "Card Blocked!" and immediately lock them out of the program.