WorksheetsCPR_Midterm online Exam
Total questions: 20
Worksheet time: 30mins
Programs are converted into machine language with the help of
Editor
Operating system
Compiler
None of the above
What should be the output:
int main()
{
int a = 20%3;
printf("%d",a);
return 0;
}
6.66
6
2
0
Which loop is most suitable to first perform the operation and then test the condition?
for loop
while loop
do while loop
None of the above
What is the output of C Program.?
int main()
{
int a=25;
while(a <= 27)
{
printf("%d ", a);
a++;
}
return 0;
}
25 25 25
Compiler error
25 26 27
27 27 27
Which of the following correctly accesses the ninth
element stored in arr, an array with 100 elements?
arr[6]
arr[8]
arr[9]
arr[10]
What is the output of C Program with Strings.?
int main()
{
char a[]={'H','E','L','L','O'};
printf("%s",a);
return 0;
}
HELLO\0
H
HELLO
hello
Space required in memory to store character data is-----byte
4 byte
2 byte
1 byte
0 byte
'x--' is which type of operator?
post decrement
pre increment
post increment
pre decrement
What is the output of C Program with arrays.?
int main()
{
int rollno[3]=[1001,1002,1003];
printf("%d",rollno[2]);
}
0
1002
1001
1003
Which of the following operator takes only integer operands?
+
/
*
%
What will be the output of following program ?
#include <stdio.h>
void main()
{
int i=1;
do
{
printf("%d,",i);
i=i+1;
}while(i>=10);
printf("\nAfter loop i=%d",i);
}
1
After loop i=1
1
After loop i=2
After loop i=2
none of the above
What is the dimension of the array int a[10][5].?
10
1
2
5
What is a String in C Language.?
String is a new Data Type in C
String is an array of Characters with null
character as the last element of array.
String is an array of Characters with null
character as the first element of array
String is an array of Integers with 0 as the
last element of array
What is the output of C Program with switch statement.?
int main()
{
int a=3;
switch(a)
{
case 1: printf("Hello"); break;
case 2: printf("Zero "); break;
case 3: printf("You are right");break;
case default: printf("Rabbit ");
}
}
Rabbit
Zero
Hello
You are right
How many choices are possible when using a single if-else statement?
1
2
3
4
Above shape is used in flowchart
for start and stop
to indicate operation
to take decision
perform input or output operation
What is the function of escape sequence'\t'
Horizontal tab
Backspace
Newline
Single quote
what will be the output of the program?
#include<stdio.h>
#include<string .h>
void main()
{
char str1[20]="Welcome ", str2="to class";
strcat(str1,str2);
puts(str1);
return0;
}
to class
to
Welcome
welcome to class
What is the output of C program.?
int main()
{
float marks[3] = {90.5, 92.5, 96.5};
int a=0;
while(a<3)
{
printf("%.f,", marks[a]);
a++;
}
}
90 92 96
90.50 92.50 96.50
0.00 0.00 0.00
Compiler error
What is output of the program?
int main()
{
int i,j,count;
count=0;
for(i=0; i<5; i++)
{
for(j=0;j<5;j++)
{
count++;
}
}
printf("%d",count);
return 0;
}
5
20
25
10
