NEW
Font size
WorksheetsC Programming
Total questions: 31
Worksheet time: 17mins
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 is the result after execution of the following code if a is 10, b is 5, and c is 10?
if ((a > b) && (a <= c))
a = a + 1;
else
c = c+1;
a = 10, c = 10
a = 11, c = 10
a = 10, c = 11
a = 11, c = 11
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 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
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
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
Which of the following correctly shows the hierarchy of arithmetic operations in C?
/ + * -
* - / +
+ - / *
/ * + -
To print out 'a' as an integer and 'b' as a decimal, which of the following printf() statement will you use?
printf("%f %lf", a, b)
printf("%f %f", a, b)
printf("%d %f", a, b)
printf("%f %d", a, b)
Which of the following is not logical operator?
&
&&
||
!
Which of the following is the correct operator to compare two variables?
equal
=
:=
==
What is the correct value to return to the operating system upon the successful completion of a program?
1
0
-1
program do not return a value
Is the syntax for the following C statement correct?:
scanf("%d", input);
True
False
Find the output in following code
int main ()
{
int a,b ;
a= b= 4 ;
b =a++;
Printf ( " %d %d %d %d", a++, --b, ++a, b--);
}
5 3 73
5 4 5 3
6 2 6 4
Syntax Error
Find Error/ output in following code
int main ()
{
int x = 1;
While (x= 0)
printf (" Hello");
}
Hello
No output
Infinite time Hello display
Error in code
Find Error/ output in following code
Void main ()
{
printf ( " % d " , printf ( " computer science"));
}
Computer science16
16computer science
Computer science
Computer science18
What will be the output of the program?
int main ()
{
printf ( 5+"Good Morning\n");
return 0;
}
Good Morning
Good
M
Morning
1. What will be the output of following program?
1 2 3 4 5
1 2 3 4
6
5
Yes
In basic flowchart symbol, a circle is called ______
Start/Stop
Comment
Connector
This is used for planning and solving a problem.
Algorithm
Flowchart
Pseudocode
Is it important for a programmer to plan the logic of his program?
Yes
No
