Font size
WorksheetsPVP_Operators in C
Total questions: 50
Worksheet time: 1hrs 15mins
int x;
int y;
int z;
x=3;
y=4;
z = ++x * y++;
printf("%d",z);
12
16
20
0
Which of the following comments about the ++ operator are correct?
1) It is a unary operator
2) The operand can come before or after the operator
3)It associates from the right
1 and 3
1 and 2
2 and 3
1,2,3
int main()
{
int a = 25%10;
printf("%d", a);
return 0;
}
5
2
2.5
5.5
!= is the example of ____________________ operator.
Relational
Logical
Assignment
Conditional
#include <stdio.h>
int main()
{
int i = 95;
char c = 97;
printf("%d, %d\n", sizeof(i), sizeof(c));
return 0;
}
2,1
4,2
2,4
2,8
#include <stdio.h>
void main()
{
int x = 5 * 9 / 3 + 9;
}
24
3
23
4
What is the output of the given code?
Error
10 20 30
10 20 1
10 200 1
What is the output of the given code?
Error
10 20 30
10 20 1
10 200 1
Which bitwise operator is suitable for unsetting a bit in a number?
|
&
^
~
All the above
What is the value of 'a' in the following statement?
int a = 10 + 10.55;
Error
20.55
20
Can't be defined
What is the value of 'a' in the following statement?
int a = 10.55 + 10.55;
20
21
21.10
error
Select the suitable statement to convert a character 'ch' to UPPERCASE.
ch = ch ^ 32
ch = ch | 32
ch = ch & ~32
ch = ch & 32
What is the output of the given code?
10 10
10 100
100 100
10 20
None of the above
++X - Identify the corresponding operator:
Post Increment
Increment
Pre Increment
None of these
int x = 15;
(x>0)?printf("x is greater"):printf("x having negative values")
Find the Output.
Error
x is greater
x having negative values
None of these
int x = 15, y=10;
if(x>20 && y<=10)
printf("Condition Satisfied");
else
printf("Condition not satisfied");
Error
Condition Satisfied
Condition not Satisfied
None of these
1011 & 0111
1000
0011
1011
None of these
In an expression involving || operator, evaluation
I. Will be stopped if one of its components evaluates to false
II. Will be stopped if one of its components evaluates to true
III. Takes place from right to left
IV. Takes place from left to right
I and II
I and III
II and III
II and IV
#include <stdio.h>
int main() {
int age=20;
age>=18? printf("eligible") : printf("not eligible");
return 0; }
eligible
not elgible
#include <stdio.h>
int main() {
int y = 2;
int z = y +(y = 10);
printf("%d\n", z);
}
12
20
Either 12 or 20
4
void main()
{
int a, b = 2, c;
a = 2 * (b++);
c = 2 * (++b);
}
a = 4, c = 8
a = 3, c = 8
b = 3, c = 6
a = 4, c = 6
char name[10];
float m1;
printf("Enter the name and cutoff of yours");
scanf("---------",name,&m1);
%s%f
%c%f
%s%lf
int a;
flloat b;
char n[10];
printf("Enter a,b n values");
scanf("%d%f%s",----------);
&a,&b,&n
&b,&a,&n
&a,&b,n
a,b,n
inside if
inside elseif
inside ifinside elseif
compile time error
COMPILE TIME ERROR
0.3
0.2
0.1
0
HELLO
Prints Nothing
HELLO HI
HI
1)i<j
2)i<j
1)i>j
2)i>j
1)i<j
2)i>j
1)i>j
2)i<j
a%2==1
a%2<1
a%2>1
a%2==0
Which combination of the integer variables x, y and z makes the variable a get the value 4 in the following expression?
a = ( x > y ) ? (( x > z ) ? x : z) : (( y > z ) ? y : z )
x : 6, y : 5, z : 3
x : 6, y : 3, z : 5
x : 3, y : 4, z : 2
x : 5, y : 4, z : 5
Case-2
Message
Case-2 Case-3 Exit from switch
Message Case-2
Message Case-2 Case-3 Exit from switch
Choice is 1
default statement
compile time error
Choice is 1default statement
-1 1
1 -1
-1 -1
1 1
14
11
12
13
10 5 3 4
10 5 4 4
10 5 3 3
10 5 4 3
Find The Output
int a = 3;
printf("%d %d %d %d", a , a++ ,a, a);
(a)
int a = 10;
int b = a++ + ++a;
printf("%d %d %d %d",b , a++ ,a, ++a);
(a)
int a = 3;
printf("%d %d %d %d",++a , a++ ,a, --a);
(a)
(a)
14 8
3 8
3 7
4 8
50 10 24 50
50 13 24 50
50 13 24 13
50 13 11 13
(a)
(a)
(a)
44
55
1510
error
4
40
1
10
20
10
9
1
Hello
World
1
0
4 4
4 1
1 4
1 1
(a)
-65535 -65535
65535 -65536
-65535 65535
65535 65535
