Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Academic Task Number: 2 Course code: CSE101

Date of allotment: 13th February, 2023 Course title: COMPUTER PROGRAMMING


Date of submission: Maximum Marks: 30
Section:-
Registration Number:- Roll Number:-
Q. Question Statement Cou Blo Marks zero\n");
N rse om per else CO L6 2
o Out ’s question printf("Its not 2
com Le zero\n"); }
e vel a) Its not zero
1 What is the output of CO L2 2 b) Its zero
this C code? 1 c) Run time error
int main() d) None
{ 6 The format identifier CO L2 2
int i = 5, j=6; %f also used for _____ 1
int k = j ^ i; data type?
printf("%d\n", k); } a). char
a) 4 b). int
b) 3 c). unsigned int
c) 6 d). double
d) None 7 What is the output of CO L6 2
2 What is the byte size CO L2 2 this C code? 2
of the variable with 1 void main()
data type as double? {
a) 10 byte int i = 0, j = 0;
b) 8 byte for (i = 0;i < 5; i++)
c) 4 byte { if (i = =3)
d) 16 byte break;
3 Which of the CO L2 2 printf("Hi \n");}}
following is not an 1 a) Hi is printed 5 times
relational operation? b) Hi is printed 3 times
a) a <= 20 c) Hi is printed 7 times
b) a >= 30 d) Hi is printed 4 times
c) a %= 40 8 What is the output of CO L6 2
d) a != 50 this C code? 2
4 What is the output of CO L2 2 void main()
this program? 1 {
void main() int i = 0 , j=1;
{ int p=5; while(i!=0)
while(p>0){ {
p--; printf("Hello");
printf(“hi”); j=j+2;
} }
} }
a). hihihihi a) Hello is printed
b) compiler error infinite times
c) hihihihihi b). Hello
d) none c). no Output
5 What is the output of d). Compile time error
this C code? What is the output of
void main() this C code?
{ int x = 0; 9 void main()
if (x = = 0) { int a=5,b=0;
printf("Its printf("%d", a<b); }
a). Compile time error 13 What is the output of CO L6 2
b). 0 CO L6 2 C Program with switch 2
c). 1 2 statement.?
d). 5 int main()
10 #include<stdio.h> CO L6 2 {int a=3;
void main() 2 switch(a)
{ {case 2:
double ch; printf("ZERO ");
printf("enter a value break;
between 1 to 2:"); case default:
scanf("%lf", &ch); printf("RABBIT "); }}
switch (ch) a) RABBIT
{case 1: b) ZERO RABBIT
printf("1"); c) No output
break; d) Compiler error
case 2: 14 What is the output of CO L6 2
printf("2"); this program? 2
break;}} #include <stdio.h>
a). Compile time error void main()
b). 1 {
c). 2 int a=10;
d). Varies if(a==10)
11 Which is not a looping CO L6 2 printf("YES");
statement? 2 else
a) for printf("NO");}
b) while a) YES
c) do while b) NO
d). goto c) Error
12 What will be the CO L6 2 d) None of the above
output of the following 2 15 What is the output of CO L6 2
C code? this program? 2
#include <stdio.h> #include <stdio.h>
void main() int main()
{ {
int i = 0; int a = 5,d=10;
for (i = 0;i < 5; i++) if (a == 6); a = 0;
if (i < 4) { if (a == 5)
printf("Hello"); a++;
break; } } else
a) Hello is printed 5 a += 2;
times printf("%d", ++d);
b) Hello is printed 4 return 0;}
times a) 10
c) Hello b) 11
d) Hello is printed 3 c) 5
times d). 2
Ans:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

You might also like