NEW
Font size
WorksheetsI/O and Operators in C
Total questions: 43
Worksheet time: 21mins
int x;
int y;
int z;
x=3;
y=4;
z = ++x * y++;
printf("%d",z);
12
16
20
0
In C programming language, which of the following type of operators have the highest precedence
Relational operators
Equality operators
Logical operators
Arithmetic operators
Which operator has the lowest priority?
++
%
+
||
The modulus operator (%) can be used only with integers.
True
False
#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
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 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
16>>2
4
8
32
64
Output of an arithmetic expression with integers and real numbers is ___ by default.?
Integer
Real number
Depends on the numbers used in the expression.
None of the above
int a = 10 + 4.867;
a = 10
a = 14.867
a = 14
compiler error.
int a = 3.5 + 4.5;
0
7
8
8.0
What is the other name for C Language ?: Question Mark Colon Operator.?
Comparison Operator
If-Else Operator
Binary Operator
Ternary Operator
Expression x % y is equivalent to____?
(x – (x/y))
(x – (x/y) * y)
(y – (x/y))
(y – (x/y) * y)
Which of the following is not a compound assignment operator?
+=
/=
%=
==
What is the output of the following printf
printf("%d",34+24/12%3*5/2-4);
35
-2
34
38
What is the output of the following code:
#include<stdio.h>
void main()
{
int a=10,b=80,c=45;
printf("%d",a<b>c);
}
0
1
10
Error
What is the output of the following code:
#include<stdio.h>
void main()
{
int a=10,b=-5;
printf("%d",a&&b);
}
1
0
Error
10
-5
What is the output of the following printf
int a=9;
printf("%d",~a);
10
-10
6
-9
What is the output of the following printf
int a=-11;
printf("%d",!a);
0
1
12
10
What is the output of the following printf:
int a=6,b=8;
printf("%d",a^b);
14
0
6
8
Which of the following operators are related to short circuit
Logical Operators
Bitwise Operators
Special Operators
Increment/Decrement Operators
What is the output of the following printf:
printf("%d",14%-4);
2
-2
3
0
What is the output of the following printf:
int a=12,b=5,c=8;
printf("%d",a+=b-=c*=a-=10);
-9
122
1
-1
What is the output of the following printf:
int a=10;
b=++a;
printf("%d,%d",a,b);
11,11
10,11
11,10
10,10
What is the output of the following printf:
int a=1,2,3,4;
printf("%d",a);
1
2
3
4
Compile time error
What is the value of printf:
printf("%d",sizeof(double));
8
10
4
6
What is the output of the following printf:
int a=10,b=3;
printf("%d",a<<b);
80
0
20
40
What is the output of the following printf:
int a=20,b=15;
printf("%d",a|b);
31
20
1
35
What is the output of the following code snippet:
int a=12;
a?printf("GEC"):printf("IT");
GEC
IT
GECIT
Error
Which of the following Arithmetic Operators are having highest priority
/, *, %
+, -
Only * and /
Only /
What is the output of the following printf:
int a=10,b=8;
printf("%d",a+~b);
1
18
19
2
What is the output of the following printf:
printf("%d",10<400>300>40);
0
1
Error
400
Who developed the C programming language?
Bjarne Stroustrup
James Gosling
Dennis Ritchie
Ray Boyce
A name having a few letters, numbers and special character _(underscore) is called
keywords
reserved keywords
tokens
identifiers
The words if, else, auto, float etc. have predefined meaning and users cannot use them as variables.
These words are called
keywords
identifier
data types
constant
Which is/are the integer constant/constants?
Decimal integer constant
Octal integer constant
Hexadecimal integer constant
All of the above
Which operators perform operations on data in binary level?
Logical operator
Bitwise operator
Additional opertors
None of the above
#include <stdio.h>
int main()
{
signed char chr;
chr = 128;
printf("%d\n", chr);
return 0;
}
128
0
-128
Garbage Value
What will be the output of the following program?
#include <stdio.h>
int main()
{
float c = 5.0;
printf ("Temperature in Fahrenheit is %.2f", (9/5)*c + 32);
return 0;
}
Temperature in Fahrenheit is 41.00
Temperature in Fahrenheit is 37.00
Temperature in Fahrenheit is 0.00
Compiler Error
The format identifier ‘%i’ is also used for _____ data type.
char
int
float
double
A single line comment line in a C Language source code can begin with
;
:
//
/*
