NEW
Font size
WorksheetsCompetitive Coding-I
Total questions: 20
Worksheet time: 10mins
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int x = 5;
if (x < 1)
printf("hello");
if (x == 5)
printf("hi");
else
printf("no");
}
hi
hello
no
error
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 0;
if (x == 1)
if (x == 0)
printf("inside if\n");
else
printf("inside else if\n");
else
printf("inside else\n");
}
inside if
inside else if
inside else
compile time error
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 0;
if (x == 1)
if (x >= 0)
printf("true\n");
else
printf("false\n");
}
Depends on the compiler
No print statement
True
False
The switch statement takes a given integer value then seeks a matching value among a number of _______ statements.
break
case
switch
goto
How many loops are there in C
1
3
2
4
Which of the following is an exit control statement
for
while
do while
continue
The value of i after the execution of the following segment is
i = 2;
for( i=0; i>10; i=i+1);
1
2
0
11
The output of the following segment is
int k, n=20;
k=(n>5?(n<=10?100:200):500);
printf("%d",n);
100
200
300
20
C language developed at _____?
AT & T's Bell Laboratories of USA in 1972
AT & T's Bell Laboratories of USA in 1970
Sun Microsystems in 1973
Cambridge University in 1972
which is the only function all C programs must contain?
start()
sys()
main()
scanf()
Which of the following is not a correct variable type?
float
real
int
double
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a = 1, b = 1, c;
c = a++ + b;
printf("%d, %d", a, b);
}
a=1, b=1
a=2, b=1
a=1, b=2
a=2, b=2
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 0;
int j = i++ + i;
printf("%d\n", j);
}
0
1
2
compile time error
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a = 1, b = 1;
switch (a)
{
case a*b:
printf("yes ");
case a-b:
printf("no\n");
break;
}
}
yes
no
yes no
compile time error
Library function pow() belongs to which header file?
math.h
square.h
stdio.h
conio.h
Is it possible to run program without main() function?
yes
no
may be
How many main() function we can have in our project?
1
2
no limit
depends on the program
int x = 10;
int main()
{
int x = 0;
printf("%d",x);
return 0;
}
10
0
compile error
undefined
What should be the output:
int main()
{
int a = 10/3;
printf("%d",a);
return 0;
}
3.33
3.0
3
0
#include "stdio.h"
int main()
{
int a = 10;
printf("%d", a);
int a = 20;
printf("%d",a);
return 0;
}
1020
1010
2020
Error: Redeclaration of a
