Skip to content

Programming and Problem Solving

CSE · Quiz · Fall 26

Paper 4 of 9Section B · Batch 72 · Humaira Afrin Prity (2)Switch

Section B · Batch 72

Paper 4 of 9

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.

Daffodil International University Department of Computer Science and Engineering Class Test - 2 (Set-A) Course: CSE-122-Programming and Problem Solving Course Teachers: Dr. S.R.H. Noori Total Time: 20 minutes Total Marks: 15 Name:.........................................................................ID..........................................Section:............ 1. Write the output of the following program 2 void main() { int x,y; for(x=0; x<3; x++) { for(y=1; y<2; y++) { printf("\n X=%d Y=%d",x,y); } } } 2. How many times "Hello DIU" will get printed? 2 void main() { int x; for(x=-1; x<=10; x++) { if(x < 5) continue; else break; printf("Hello DIU"); } } A. Infinite times | B. 11 times C. 0 times | D. 10 times Answer: 3. Write the output of the following program 2 void main() { int a=300,b=150,c=100; if(a>=400) b=300; c=200; printf("B=%d C=%d\n",b,c); } 4. Write the output of the following program 2 void main() { int x=5; while(x>1) { x=x-1; printf(" %d \n",x); x--; } } 5. Write the output of the following program 2 void main() { int check=3; switch(check) { case 1 : printf("Grade A \n"); case 2 : printf("Grade B \n"); case 3 : printf("Grade C \n"); default: printf("Invalid \n"); } } 6. Write the output of the following program 2 void main() { int a =5 , b =3 , c=1; b = (a == 5) ? 4 : 5; c = (b == 3) ? 6 : 7; printf("Value of b is %d\n",b); printf("Value of c is %d\n",c); } 7. Write a C program to find sum of all odd numbers from 1 to n, where n is given by the user. 3