You are on page 1of 2

MILITARY INSTITUTE OF SCIENCE AND TECHNOLOGY

Department of Industrial & Production Engineering (IPE)


Course Code: CSE281
Course Name: Computer Programming
Class Test-02 Spring 2023

Total Marks: 20 Time:30 mins

1. Suppose you are implementing a program for your class that manages the 4
Exam Schedule (CT routine) for the whole semester. The program should
allow the students to search for the date of any course based on the course
titles.

a) Explain how you would use if-else statements to implement the search
functionality.

b) Discuss how you would use a switch case statement to implement the
search functionality.

2. Observe the code carefully and answer the following questions: 5

a) How many times will the word “HELLO” be printed?


b) How many times will the word “World” be printed?
c) What modification should be made in the code to print “HELLO”
18 times? How many times will the word “World” be printed then?
d) If the outermost loop is removed, how many times will the word
“HELLO” and “World” be printed?

for(i=0;i<2;i++)
{
for(j=0;j<5;j++)
{
for(k=0;k<9;k++)
{
printf(“HELLO\n”);
}
printf(“World\n”);
}
}
3. (72)8 + (11101110)2 – 36 = (?)5 4

4. Consider the equation (123)5 = (x8)y with x and y as unknowns. Find out 4
all possible values of x and y.

5. Define “Endless Loop” with an example. 3

You might also like