WorksheetsProgramming Round 1
Total questions: 21
Worksheet time: 30mins
#include<stdio.h>
int main(){
int a=45;
a=a<46;
printf("%d",a);
return 0;
}
1
2
3
4
#include<stdio.h>
int main(){
int a=1,b=2;
a+=b=a;
printf("%d%d",a,b);
return 0;
}
12
32
21
16
#include<stdio.h>
int main(){
char a[8]="same";
if(a=="same")
printf("yes");
else
printf("no");
return 0;
}
yes
Yes
no
No
#include<stdio.h>
int main(){
int a=1,b=2;
a+=b=a;
printf("%d%d",a,b);
return 0;
}
04 13 23
05 14 23
05 41 32
50 32 14
#include<stdio.h>
int main{
int i[3] = {1,4,2};
if(i[2]==i[3]){
printf(“loop”);
}
else{
break;
}
}
Runtime Error
Compiletime Error
Reference Error
loop
#include <stdio.h>
void main()
{
int a = 5, b = -7, c = 0, d;
d = ++a && ++b || ++c;
printf("\n%d%d%d%d", a, b, c, d);
}
6-601
6601
6513
6-611
#include <stdio.h>
void main()
{
double b = 3 && 5 & 4 % 3;
printf("%lf", b);
}
1
1.000000
4.00000
4
#include<stdio.h>
int main()
{
char a=97;
char b=a + 0x01;
switch(++a,++b){
case'a':
printf("a");
break;
case'b':
printf("b");
break;
case'c':
printf("c");
break;
case'd':
printf("d");
break;
default:
printf("nothing");
break;
}
return 0;
}
a
b
c
d
#include<stdio.h>
#define square(x) x*x;
int main()
{
int a=6,b;
b=36/square(a);
printf("%d",b);
return 0;
}
18
9
36
Error
#include<stdio.h>
int main()
{
int a=3,b;
b=(3,4,5);
printf("%d,%d",a,b);
return 0;
}
3,5
3,4
3,3
3,3,4,5
#include<stdio.h>
int main()
{
int a=4,b,c;
b = --a;
c = a--;
printf("%d %d %d",a,b,c);
return 0;
}
3 3 3
3 2 2
2 3 3
3 2 1
#include<stdio.h>
int main()
{
int a=1,b=2,c;
c= (a>b) ? (a-b) : (a+b);
printf("%d,%d,%d",a,b,c);
return 0;
}
1,0,1
1,2,3
1,1,1
3,2,1
#include<stdio.h>
#define bar(x,y) ((x)>(y)) ? (x*y) : (y-x);
int main()
{
int p=14,q=2,r=4;
r+=bar(++p,q++);
printf("%d,%d,%d\n",p,q,r);
return 0;
}
16,4,52
14,6,46
18,8,48
14,2,4
What is the 16-bit compiler allowable range for integer constants?
-32767 to 32768
-32668 to 32667
-32768 to 32767
3.4e38 to 3.4e38
A pointer is a memory address. Suppose the pointer variable has p address 1000, and that p is declared to have type int*, and an int is 4 bytes long. What address is represented by expression p + 3?
1004
1012
1008
1002
What does modularity mean?
Hiding part of program
Sub dividing program into smaller parts
Overriding parts of program
Wrapping things into single unit
Which is valid expression in c language?
int pos_num = 100000;
int pos num = 1000;
int pos num == 10000;
int pos_num = 100,000;
Array is a _________ data structure.
Primary
Linear
Data Type
Non-Linear
Output of
printf("%d",5/2); is (a)
In which of the following modes, the user can read and write the file?
w
r+
b+
r
How was the quiz?
----------Feedback------------
Good
Bad
Satisfactory
