Q.56 Find the output of the following program
#include<stdio.h>
void main()
{
int i,j;
for(i=1;i<=5;i++)
{
(b) Hello Hello Hello
Hello Hello Hello
(d)Hello Hello
Hello Hello Hello
for(j=1;j<=i;j++)
{
printf(“1”)
}
printf(“\n”)
}
}
(a) 1
11
111
1111
111111
(b)11111
(b) 1
|
(c)
|
11111
|
1
|
|
1111
|
1
|
|
111
|
1
|
|
11
|
1
|
|
1
|
Q.57 Find the output of the following program
#include
void main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf(“*”)
}
printf(“\n”)
}
} (a)* (c)*
**
***
****
*****
(b)***** (d)*****
****
***
**
*
Q.58 Find the output of the following program
#include
void main()
{
int n=400;
if(n%10==0)
{
printf(“Yes”)
}
else
{
printf(“No”)
}
}
(a)Yes
(c)Compilation Error
(b)No
(d)None of the above
Q.59 Find the output of the following program
#include<stdio.h>
void main()
{
int i=1,j=1;
for(;;)
{
if(i>3) break;
else j+=i;
printf(“%d\n” j)
i+=j;
}
}
(a)Compile error
(c)2
(b)2
5
(d)2
3
Q.60Find the output of the following program
#include<stdio.h>
void main()
{
int i;
for(i=0;i<=8;i++)
{
if(i%2==0) printf(“%d\n” i+1) else if(i%3==0) continue;
else if(i%5==0)
break;
printf(“\nEnd of the program\n”)
}
printf(“\nEnd of program\n”)
}
(a) 1
End of program
End of program
3
End of program
5
End of program
End of program
(b) 1
End of program
2
End of program
3
(c)Error
End of program
4
End of program
5
End of program
(d)None of the above
Q.61 Select the correct answer
(a) I=10 do
{
do something
}while(I<10);
(b)”do something” will not be executed at all
(c)do-while loop is not a valid loop.
(d)None of the above
Q.62 Find the output
void main()
{
int i=1,j=2,k=3;
if(i==1)
if(j==2)
if(k==3)
{
printf(“ok”)
break;
}
else printf(“continue”) printf(“bye”)
}
(a)ok
(c)Misplaced break
Q.63 Find the output
void main()
{
int I,j=6; for(;i=j;j-=2) printf(“%d” j)
} (a)Error (c)642
(b)okbye
(d)None of there
(b)Garbage value
(d)6420
Q 64 Select the correct statement if „n‟ is the number of times the loop is executed
(a)In a while loop the control conditional check is performed n times.
(b)In a do-while loop the control conditional check is performed n+1 times.
(c)Break is a keyboard used with if and switch case.
(d)None of these
Q.65 Find output
void main()
{
Float x=2.8,y=4;
if(x%=y)
printf(“Both are equal”)
else
printf(“Not equal”)
}
(a)Both are equal
(c)Error
(b)Not equal
(d)None of these
Q.66 Find the correct output
void main()
{
int a=2,b=0,c=-2;
if(b,a,c)
printf(“True”)
else
}
printf(“False”)
(a)True (b)False
(c)Compile time error (d)Run time error
Q.67 The break statement is used to exit from a
(a)DO loop
(c)SWITCH statement
(b)FOR loop
(d)all of above
Q.68 In which statements, does a CONTINUE statement cause the control to go directly to the test condition
and then continue the looping process?
(a)FOR and WHILE
(c)DO-WHILE AND IF-ELSE
(b)WHILE and IF-ELSE (d)While and DO-WHILE
Q.69 Find the output of following program
#include<stdio.h>
void main()
{
int I; for(i=0;i<10;i++) printf(“%d” i)
}
(a)0 1 2 3 4 5 6 7 8 9
(c)Run Time Error
(b)Compile Error
(c)9
Q.70 Find the following program
#include
void main()
{
int i=2,j=2; while(i+1?—i:j++) printf(“%d” j)
}
(a)1 (b)2
Q.71 Find the following program
#include
void main()
{
int x=011,i;
for(i=0;i+=3)
{ printf(“Error”) continue; printf(“Exit”)
}
(c)3
(d)4
} (a)EnterExitEnterExitEnterExit (c)EnterEnterEnterExit
(b)EnterEnterEnter
(d)None of the above
Q.72 Find the output of following program
#include
void main()
{
int i,j;
i=j=2;
while(--i&&j++)
printf(“%d%d” = j)
}
(a)1 30 4 (b)1 3 (c)Error (d)None of the above
Q.73 Find the following program
#include<stdio.h>
void main()
{
int x=1; for(;x<5;x++) printf(“%d” ++x)
}
(a)1234 (b)123456
ANSWER KEY
(c)135 (d)24
-
Que No
|
Ans
|
Que No
|
Ans
|
Que No
|
|
Share with your friends: |