Font size
WorksheetsC Programming
Total questions: 100
Worksheet time: 2hrs 43mins
How many main() function we can have in a program
1
2
No Limit
None
How many loop are there in C
2
3
1
4
When is C Language was invented
1970
1972
1978
1979
Library function getch() belongs to which header file?
stdio.h
conio.h
stdlib.h
none
which of the following ways can be used to include header file in C program
#include"stdio.h"
#include<stdio.h>
both
none
What are Parameter passing techniques available in C Language
Call by value
Call by reference
Both
None
Array is collection of elements of
Dis-similarity Data Types
Similar Data Types
Both
None
structures are collection of elements of
Dis-similarity Data Types
Similar Data Types
Both
None
what are the basic data types in C Language
int , float
int , float , char
int, float, char , double
int, char, double
Arithmetic operators available in C Language are
+ , -, *, / , %
+ , -, *, / , <
+ , -, *, ==, <=
&&, ||, ==, >=
Pointer variable is to hold
int value
float value
Address
None
Examples of unconditional statements
goto , continue
goto, continue, break
break, continue
goto break
Conditional statements are
Simple if , if-else , else-if, switch
Simple if , if-else , else-if, while
Simple if , do-while , else-if, switch
Simple if , if-else , do-while , for
Program execution starts from
#include
main()
Other sub-functions
None
Conditional operator (? :) is a
Unary Operator
Binary Operator
Ternary Operator
All
Examples for Unary operators
% , /
==, &&
<= , >=
++ , --
What is output for:
a=5;
printf("%d", a++) ;
5
6
4
0
What is the Output:
int a=5;
printf("%d", ++a);
5
6
7
4
What is the output:
int i;
printf("%d", i);
0
Garbage value
1
Error
What is the Output:
int a=5,b=6,c=2;
printf("%d", a+b*c);
17
22
11
Error
What is the Output :
void main()
{
int a=5,b=6,k;
k=b>a?b:a;
printf("%d",k);
}
5
6
11
Error
what is the output:
void main()
{
int a=5;
a+=2;
printf("%d",a);
}
7
5
6
Error
What is the Output:
void main()
{
int a=4, b=2,c;
c=a*b;
printf("%d%d%d",b,c,a);
}
4, 2, 8
2, 4, 8
4, 8, 2
2, 8, 4
what is the Output:
void main()
{
int a=3,b=6;
if(a>b)
printf("%d",a);
else
printf("%d",b);
}
3
6
Compilation Error
Run Time Error
What is the technique name for the following Function call swap():
void main()
{
swap(3,7)
}
Call by value
Call by reference
Both
None
What is the Keyword used to define a Structure
Structure
Static
Dynamic
Struct
which of the following is Address operator
&&
&
||
==
"goto" statement is:
Conditional statement
Assignment statement
Declaration statement
Unconditional statement
Which of the following is a Unary Operator
&&
||
<
!
C language was developed by
B. Stroustrup
James Gosling
Anders Hejlsberg
Dennis M.Ritchie
1.Relational
2.Arithmetic
3.Logical
4.Assignment
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 ()
{
Static int num = 8;
printf ( " %d" , num = num -2 );
if (num != 0)
main ();
}
8 6 4 2
Infinite output
Invalid because main function can't call it self
6 4 2 0
Find error/ output in following code
How many times " placement Questions" will print.
int main
{
int x;
for ( x=1;x <=10; x++)
{
if ( x < 5)
Continue;
else
break;
Printf (" placement Question ");
{
return 0;
}
Infinite time
11 times
0 time
10 times
Find error/ output in following code
int main ()
{
int a = 10, b = 25;
a = b++ + a++;
b= ++b + ++a;
printf ( " %d %d n", a, b );
}
36 64
35 62
36 63
30 28
Find error/ output in following code
Void fn ()
{
Static int i= 10;
Printf ( " %d " , ++i );
}
int main ()
{
fn();
fn();
}
10 10
11 12
11 11
12 12
Find error/output in following code
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
Find error/ output in following code
int main ()
{
int i = 0;
for ( ; ;)
printf ( "%d", i) ;
return 0;
}
O times
Infinite times
10 times
1 times
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
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
Find Error/ output in following code
Void main ()
{
int a= 1, b= 2, c = 3;
Char d = 0;
if (a,b,c,d)
{
printf ( " EXAM") ;
}
}
No output and No error
EXAM
Runtime Error
Compile time error
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
Are the expression *ptr++ and ++*ptr are the same ?
True
False
Is there any difference between the following two statements?
Char *p = 0;
Char *t = NULL ;
Yes
No
Point out the error in the program
f ( int a, int b)
{
int a;
a = 20;
return a;
}
Missing parentheses in return statement
The function should be defined as int f ( int a, int b)
Redeclaration of a
None of the above
int main()
{
int a = 10, b = 25;
a = b++ + a++;
b = ++b + ++a;
printf("%d %d n", a, b);
}
36 64
35 62
36 63
30 28
int main()
{
char arr[7]="Network";
printf("%s", arr);
return 0;
}
Network
N
Garbage Value
Compilation error
#include<stdio.h>
int main()
{
char arr[11]="The African Queen";
printf("%s",arr);
}
The African Queen
The
The African
Compilation error
#include<stdio.h>
int main()
{
float a=0.7;
if(a<0.7)
{
printf("C");
}
else
{
printf("C++");
}
}
C
C++
Compilation Error
None of the these
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
int main()
{
int a = 1, b=2, c=3;
char d = 0;
if(a,b,c,d)
{
printf("EXAM");
}
}
No Output and No Error
EXAM
Run time error
Compile time error
#include<stdio.h>
int main()
{
int a=2,b=7,c=10;
c=a==b;
printf("%d",c);
}
0
7
2
Compilation error
What will be output of the following c program?
#include<stdio.h>
int main()
{
int max-val=100;
int min-val=10;
int avg-val;
avg-val = max-val + min-val / 2;
printf("%d",avg-val);
}
55
105
60
Compilation error
There are ___ storage classes in C
2
4
6
8
The data type int uses ___ bytes of memory.
2
4
6
8
To show end of program ___ symbol used?
<
(
{
}
Which is the incorrect form of variable?
sale20
Name
12Rno
Net_Salary
What is the default C Storage Class for a variable?
static
auto
register
extern
When variable declare as “ a++ “ it increment variable by ___ value.
0
1
2
3
To find reminder _____ operator is use in C program
%
@
/
|
By using _____ function we can clear output window in C program
clear()
clrscr()
screenclear()
clean()
C program is save with _____ extension.
.a
.b
.c
.d
Using if else statement we can check _____ condition.
1
2
3
4
Switch statement checks only _____ condition.
Equality
Not equal to
Less than
Greater than
Which one of following is not a reserved keyword in C?
auto
main
case
default
The printf() & scanf() function come from _____ header file.
conio.h
stdio.h
math.c
getio.h
Each statement in C program is end with _____ symbols.
:
,
/
;
Static Storage class has _____ initial value.
0
1
2
3
There are _____ keywords in C.
30
31
32
33
Which statement is incorrect about Identifier?
They can contain alphabets, digits & underscore only
The identifier is made up of 31 character.
They can use keyword.
The first character must be an alphabet & underscore.
To print multiple character _____ formatting character use.
%d
%f
%s
%c
By using “ \n ” escape sequence the output is display in_____.
New Line
1st Line
Middle Line
End Line
A identifier must be begin with_____
Alphabets
Digits
Underscore or digits
Alphabets or Underscore
