0% found this document useful (0 votes)
22 views2 pages

PSCP Test-1

Uploaded by

sk23ecb0f24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

PSCP Test-1

Uploaded by

sk23ecb0f24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

DEPARTMENT OF MATHEMATICS

MA144: Problem Solving and Computer Programming


Class Test-1 (30-12-2022)
I B.Tech. (ECE Sec C) AY 2022-23 (odd semester)
Duration: 45 mins Max. Marks: 15 Marks Secured:

Name of the Student: Roll No.:

Q No. 8 carries 2 marks and other questions carry 1 mark each.

4. What would be the output of the following


1. Find out the output of the following program.
program?
int main()
{ int i, j; int main()
for (i = 0; i <= 2; i++) { int a=10;
{ switch(a)
for (j = 0; j <= 2;) {
{ case 10: a = a + 10;
cout<<j<<" "; case 20: a = a + 20;
break; case 30: a = a + 30;
} case 40: a = a + 40;
cout<<i<<" "; break;
} case 50: a = a + 50;
return 0; default: a = a + 100;
} }
cout<<a;
return 0;
}

2. Consider the following while loop. How many


times will the loop be entered?

int i = 400, j = 70; 5. What would be the output of the following


while(i > 0 && j > 0) program?
{
i = i - j; int main()
j = j - 5; {
} double x = 4.52, y = 4.54;
if (x = y)
cout<<"equal"<<endl;
else
cout<<"not equal"<<endl;
3. In the following program, how many times will if (x == y)
the string "nit warangal" get printed? cout<<"equal"<<endl;
else
int main() cout<<"not equal"<<endl;
{ int n=100, i, j; return 0;
for (i = 0; i < n; i++) }
{
for (j = n-i; j > 0; j--)
cout<<"nit warangal";
}
return 0; 6. Find out the value of the following expression.
}
20%5-13+16%8/4*5+4-8/5*10
7. What would be the output of the following 11. Find out the output of the following program.
program?
int main()
int main() {int y, x=096.5;
{ do {
int a,x = 10; y=x%10;
a = x++ - x++; cout<<y;
a = a+ x++ + x++; } while((x = x/10) != 0);
cout<<x<<endl; return 0;
cout << a; }
return 0;
}

12. Find out the output of the program.

8. Find out the output of the following program. int main()


int main() {
{ int i;
char sym='345'; for (i = 0; i < 20; i++)
int a=sym, b, x=20, y=10; {
b=a%x++ +a/y+a-x+2*++y; switch (i) {
cout<<b; case 0: i += 5;
return 0; case 1: i += 2;
} case 5: i += 5;
default: i += 4;
break;
}
cout<<i<<' ';
9. Find out the output of the following program. }
return 0;
int main() }
{
int n = 10, count = 0, sum = 0;
while(--n > 0)
{
n /= 2; 13. How many times section C will be printed by
count++; the following program?
sum +=n;
} int main(){
cout<<n<<' '<<count<<' '<<sum; int num = 5; int num2 = 1;
return 0; while (num2 < 4)
} {
for ( ; num >= num2 ; num-- )
cout<<"section C"<<endl;
num2++;
}
10. Find out the output of the following program. return 0;
(program uses nested ternary operation) }
int main()
{
int a=-2, b=10, c=4, d=5;
14. Find out the output of the following program.
(a > 0 && b < 0) || (a < 0 || b > 0)?
((a > 0 && b < 0) || (a < 0 && b ==0)? int main(){
cout<<d-a+5%a : cout<<b*a/b/c+a) int x;
: cout<<64/8%7+a-b+d; cout<< (x=x = 2 && 3 > 4);
return 0; return 0;
} }

You might also like