NEW
Font size
WorksheetsQuiz - I
Total questions: 25
Worksheet time: 18mins
The minimum number of temporary variables needed to swap the contents of two variables is
0
1
2
3
int main ()
{
int x = 24, y = 39, z = 45;
z = x + y;
y = z - y;
x = z - y;
printf ("n%d %d %d", x, y, z);
}
24 39 63
39 24 63
24 39 45
39 24 45
int main() {
int m = -10, n = 20;
n = (m < 0) ? 0 : 1;
printf("%d %d", m, n);
}
-10 0
10 20
20 -10
0 1
int main() {
int x = 0, y = 0;
if(x > 0)
if(y > 0)
printf("True");
else
printf("False");
}
No Output
True
False
Error because of dangling else problem
#include<stdio.h>
int main()
{
int a=2,b=7,c=10;
c=a==b;
printf("%d",c);
}
0
7
2
Compilation error
What is the output of C Program.?
int main()
{
int a=32;
do
{
printf("%d ", a);
a++;
}
while(a <= 30);
return 0;
}
32
33
30
No Output
What will happen when the following code is executed?
void main()
{
printf("MIET");
main();
}
Wrong statement
It will keep on printing MIET
It will print MIET once
None of these
What will the result of 'num' variable after execution of the following statements?
int num = 58;
num % = 11;
3
5
8
11
What will be the output of the following code?
#include <stdio.h>
int main()
{
int *ptr, a = 10;
ptr = &a;
*ptr += 1;
printf("%d,%d/n", *ptr, a);
}
10, 10
10, 11
11, 10
11, 11
What is the output of C Program.?
int main()
{
int k;
for(k=1; k <= 5; k++);
{
printf("%d ", k);
}
return 0;
}
1 2 3 4 5
1 2 3 4
6
5
What is the output of C Program.?
int main()
{
int k;
for(;;)
{
printf("TESTING\n");
break;
}
return 0;
}
No Output
TESTING
Compiler error
None of the above
What is the output of C Program.?
int main()
{
int k;
for(printf("FLOWER "); printf("YELLOW "); printf("FRUITS "))
{
break;
} return 0;
}
Compiler error
FLOWER FRUITS
FLOWER YELLOW
FLOWER YELLOW FRUITS
Loops in C Language are implemented using.?
While Block
For Block
Do While Block
All the above
What is the way to suddenly come out of or Quit any Loop in C Language.?
continue; statement
break; statement
leave; statement
quit; statement
Which loop is faster in C Language, for, while or Do While.?
for
while
do while
all of the above
Choose correct C while loop syntax.
while(condition) { //statements }
{ //statements }while(condition)
while(condition); { //statements }
while() { if(condition) { //statements } }
Choose a correct C for loop syntax.
for(initalization; condition; incrementoperation) { //statements }
for(declaration; condition; incrementoperation) { //statements }
for(declaration; incrementoperation; condition) { //statements }
for(initalization; condition; incrementoperation;) { //statements }
Choose a correct C do while syntax.
dowhile(condition) { //statements }
do while(condition) { //statements }
do { //statements }while(condition)
do { //statements }while(condition);
What is the output of C Program.?
int main()
{
int a=5;
while(a==5)
{
printf("RABBIT");
break;
}
return 0;
}
RABBIT is printed unlimited number of times
RABBIT
Compiler error
None of the above.
What is the output of C Program.?
int main()
{
int a=5;
while(a=123)
{
printf("RABBIT\n");
break;
}
printf("GREEN");
return 0;
}
GREEN
RABBIT GREEN
RABBIT is printed unlimited number of times.
Compiler error.
C can be used on................
Only MS-DOS operating system
Only Linux operating system
Only Windows operating system
All the above
C programs are converted into machine language with the
help of.....................
An Editor
A compiler
An operating system
None of the above
A character variable can at a time store?
1 character
8 characters
254 characters
None of the above
A C variable cannot start with............
An alphabet
A number
A special symbol other than underscore
Both (2) & (3) above
Which of the following statement is wrong?
mes = 123.56 ;
con = 'T' * 'A' ;
this = 'T' * 20 ;
3 + a = b ;
