NEW
Font size
WorksheetsQuiz on Basics of C
Total questions: 10
Worksheet time: 5mins
What will be the output of the following C code?
#include <stdio.h>
void main()
{ int x = 5;
if (true);
printf("hello");
}
a) It will display hello
b) It will throw an error
c) Nothing will be displayed
d) Compiler dependent
#include <stdio.h>
int x;
void main()
{
if (x)
printf("hi");
else
printf("how are u");
}
a) hi
b) how are you
c) compile time error
d) error
What does the following code fragment write to the monitor?
int sum = 14;
if ( sum < 20 )
System.out.print("Under ");
else
System.out.print("Over ");
System.out.println("the limit.");
Under
Over.
. Under the limit
Over the limit.
int main()
{
int a = 25%10;
printf("%d", a);
return 0;
}
5
2
2.5
5.5
!= is the example of ____________________ operator.
Relational
Logical
Assignment
Conditional
#include <stdio.h>
void main()
{
int x = 5 * 9 / 3 + 9;
}
24
3
23
4
int x = 15;
x=+5;
printf("x value is: %d",x);
Error
x value is: 20
x value is: 15
None of these
int x = 15, y=10;
if(x>20 && y<=10)
printf("Condition Satisfied");
else
printf("Condition not satisfied");
Error
Condition Satisfied
Condition not Satisfied
None of these
1011 & 0111
1000
0011
1011
None of these
Which header file can be used to define input/output function prototypes and macros?
- math.h
- memory.h
- stdio.h
- dos.h
