Assignment 4 (XII) - Ch4
Assignment 4 (XII) - Ch4
Instructions
• Ensure your Roll Number, Full Name, and Section are clearly written on the first page of your assignment.
• Use proper sheets for your work.
• Maintain neat and organized handwriting. Use a marker for headings.
• Plagiarism is strictly prohibited. Submissions found to be copied from others will result in a zero mark for all
involved.
• Late submissions will not be entertained, and a zero mark will be awarded for assignments submitted after the
deadline.
Q1. Multiple Choice Questions (MCQs). Only write correct answers in answer sheet.
[5 Marks: 1 mark each]
4. Which of the following transfers control to the beginning of the loop, skipping the remaining
statements?
a. exit function b. continue function c. break function d. nested loop
(5 Marks)
Q3. Write a program that prints a table for a number taken from a user. (Hint: Use Loop)
5x1=5
5 x 2 = 10
5 x 3 = 15
.
.
.
5 x 10 = 50
(5 Marks)
Q4. Write a program that repeatedly ask user for a number and then prints its square. The program will
terminate and say goodbye only when user enters 0. (Hint: Use while loop for repetition)
Enter a number: 5
Square is 25
Enter a number: 3
Square is 9
Enter a number: 0
Goodbye!
(5 Marks)
Q5. Write a program that works as calculator. The program should take 2 numbers and an operator from user,
and then print the result based on the operator used. After each result the program should ask user whether he
wants to continue or not. (Hint: Use Switch Statements based on operator and while loop to ask repeatedly)
5–3=2
4 x 6 = 24
(5 Marks)
Q6. Write a program that gives the below output: (Hint: Use nested loop)
Example: 12345
1234
123
12
1
(5 Marks)