WorksheetsC Language Basics
Total questions: 26
Worksheet time: 15mins
Which header file is required to perform standard input and output opeartions
math.h
stdio.h
input.h
io.h
Which of the following is correct identifier?
int
1ab
a_123
a 123
what is the output of the following statement?
printf("hi\nhello\nhow\bare\ryou");
hi
hello
how
are
you
hi
hello
hoare
you
hi
hello
youre
hi
hello
youare
Who is the father of C language?
Dennis Ritche
Charles Babbage
Steve Jobs
V Kohli
Which of the following is not a valid C variable name?
int num;
float price;
char a_s;
int $total;
The C-preprocessors are specified with _________ symbol.
$
#
&
*
What is the sizeof(char) in a 32-bit C compiler?
1 bit
2 bits
1 byte
2 bytes
What will be the final value of x in the following C code?
#include <stdio.h>
void main()
{
int x = 5 * 9 / 3 + 9;
}
3.75
24
3
15
What will be the output of the following C code snippet?
#include <stdio.h>
void main()
{
1 < 2 ? printf("Hi"): printf("hello");
}
Hi
hello
hi
hello
none
What is the size of an int data type in 64-bit compiler?
4 bytes
8 bytes
10 bytes
2 bytes
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int y = 3;
int x = 5 % 2 * 3 / 2;
printf("Value of x is %d", x);
}
Value of x is 1
Value of x is 3
Value of x is 1.5
Error
What is the precedence of arithmetic operators (from highest to lowest)?
%, *, /, +, –
%, +, /, *, –
+, -, %, *, /
%, +, -, *, /
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a = 10;
double b = 5.6;
int c;
c = a + b;
printf("%d", c);
}
15.6
15
16
10
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a = 10, b = 5, c = 5;
int d;
d = a == (b + c);
printf("%d", d);
}
Error
1
10
15
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int x = 1, y = 0, z = 5;
int a = (x && y) || (z++);
printf("%d", z);
}
error
5
6
0
Which among the following is NOT a logical opearator?
&&
||
!
!=
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int x = 1, z = 3;
int y = x << 3;
printf(" %d\n", y);
}
error
1
8
-1
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int h = 8;
int b = h++;
printf("%d%d\n", b, h);
}
8 8
8 9
9 9
9 8
What will be the output of the following C code?
#include <stdio.h>
void main()
{
char b = 'B';
printf("%d\n", b);
}
65
66
B
b
What will be the output of the following C code?
#include <stdio.h>
void main()
{
char b = 'B';
printf("%c\n", b+32);
}
65
66
B
b
The ______ symbol denotes decision making in flowchart?
What will be the output of the following C code?
#include <stdio.h>
void main()
{
char b = 'B';
printf("%c\n", b+3);
}
E
e
B
b
The ______ symbol used for input/ output operation in flowchart?
What is the output of this program?
#include <stdio.h>
void main()
{
printf("hello\rworld\n");
printf("hello\b\b\bworld\n");
}
hello
helloworld
world
heworld
world
hellworld
helloworld
heworld
What is the output of the following code?
void main()
{
int i=1;
i=2+2*i++;
printf("%d",i);
}
2
3
4
5
What is the output of this program?
main ()
{
int i=5;
printf( "%d %d %d " , i, i<<2, i>>2);
}
5 1 20
5 20 1
5 20 20
5 1 1
