NEW
Font size
S
M
L
XL
WorksheetsSASI -1st year -DAY1-AN(27.11.23)
Total questions: 15
Worksheet time: 15mins
Name
Class
Date
1.
#include <stdio.h>
int main()
{
signed char chr;
chr = 128;
printf("%d\n", chr);
return 0;
}
a)
128
b)
-128
c)
Depends on the compiler
d)
None of the mentioned
2.
What is short int in C programming?
a)
The basic data type of C
b)
Qualifier
c)
Short is the qualifier and int is the basic data type
d)
All of the mentioned
3.
#include <stdio.h>
int main()
{
float f1 = 0.1;
if (f1 == 0.1)
printf("equal\n");
else
printf("not equal\n");
}
a)
equal
b)
not equal
c)
output depends on the compiler
d)
error
4.
#include <stdio.h>
int main()
{
int x = 10000;
double y = 56;
int *p = &x;
double *q = &y;
printf("p and q are %d and %d", sizeof(p), sizeof(q));
return 0;
}
a)
p and q are 4 and 4
b)
p and q are 4 and 8
c)
compiler error
d)
p and q are 2 and 8
5.
#include <stdio.h>
void main()
{
int x = 0;
if (x = 0)
printf("Its zero\n");
else
printf("Its not zero\n");
}
a)
Its not zero
b)
Its zero
c)
Run time error
d)
None
6.
#include <stdio.h>
int main()
{
int i = 1;
if (i++ && (i == 1))
printf("Yes\n");
else
printf("No\n");
}
a)
Yes
Depends on the standard
b)
No
c)
Depends on the compiler
d)
Depends on the standard
7.
#include <stdio.h>
void main()
{
int x = 0, y = 2, z = 3;
int a = x & y | z;
printf("%d", a);
}
a)
3
b)
0
c)
2
d)
run time error
8.
#include <stdio.h>
int main()
{
printf("C programming %s", "Class by\n%s ccc", "WOW");
}
a)
C programming Class by
WOW ccc
b)
C programming Class by\n%s ccc
c)
C programming Class by
%s ccc
d)
Compilation error
9.
#include <stdio.h>
#define a 10
int main()
{
const int a = 5;
printf("a = %d\n", a);
}
a)
a = 5
b)
a = 10
c)
Compilation error
d)
Runtime error
10.
#include <stdio.h>
int main()
{
int var = 010;
printf("%d", var);
}
a)
2
b)
8
c)
9
d)
10
11.
#include <stdio.h>
void main()
{
char a = 'a';
int x = (a % 10)++;
printf("%d\n", x);
}
a)
6
b)
Junk Value
c)
Compile time error
d)
7
12.
#include <stdio.h>
int main()
{
int i = -3;
int k = i % 2;
printf("%d\n", k);
}
a)
Compile time error
b)
-1
c)
1
d)
Implementation defined
13.
#include <stdio.h>
int main()
{
int i = 3;
int l = i / -2;
int k = i % -2;
printf("%d %d\n", l, k);
return 0;
}
a)
Compile time error
b)
-1 1
c)
1 -1
d)
Implementation defined
14.
#include <stdio.h>
int main()
{
int i = 5;
i = i / 3;
printf("%d\n", i);
return 0;
}
a)
Implementation defined
b)
1
c)
3
d)
Compile time error
15.
#include <stdio.h>
void main()
{
int x = 5 * 9 / 3 + 9;
}
a)
3.75
b)
Depends on compiler
c)
24
d)
3
Reset
