The operator in C language. Multiple-Choice Questions and Answers on Operators in C Language. For MCQ on C language, Data Types check C Data Types MCQ
Operator In C Language
Which of the following is an example of the relational operator in the C language ??
A. <
B. >
C. !=
D. All of these
int a = 12 + 3 * 5 / 4 – 10 ??
A) 12, 3, 5, 4 and 10 are Operators.+, -, * and / are Operands. = is an increment operator.
B) 12, 3, 5, 4 and 10 are Operands. +, -, * and / are Operators. = is decrement operator.
C) 12, 3, 5, 4 and 10 are Operands. , -, * and / are Operators. = is an assignment operator.
D) 12, 3, 5, 4 and 10 are Operands.+, -, * and / are Logical Operators. = is an assignment operator.
Do all arithmetic operators have the same level of precedence ??
A. True
B. False
C. None of these
Operator % in C Language is called ??
A) Percentage Operator
B) Quotient Operator
C) Modulus
D) Division
Which operator checks if the value of the left operand is greater than the value of the right operand ??
A. = =
B. <
C. >
D. =
++ and — are unary operators ??
A. True
B. False
C. None of these
D. Both Unary and bitwise
int a = 10 + 4.867; ??
A) a = 10
B) a = 14.867
C) a = 14
D) compiler error.
!= is the example of which operator ??
A. Relational
B. Logical
C. Assignment
D. Conditional
int a = 3.5 + 4.5; ??
A) a = 0
B) a = 7
C) a = 8
D) a = 8.0
C Operators
An arithmetic expression without parenthesis will be evaluated from left to right using rules of precedence of operators ??
A. True
B. False
C. None of these
D. Yes, but without using the rules
float var = 3.5 + 4.5; ??
A) var = 8.0
B) var = 8
C) var = 7
D) var = 0.0
Which of the following is not a bitwise operator ??
A. &
B. <<
C. >>
D. *
Choose the right statement ??
int main()
{
float c = 3.5 + 4.5;
printf(“%f”, c);
return 0;
}
A) 8.0
B) 8.000000
C) 8
D) 7
Which operator checks if the values of two operands are equal ??
A. = =
B. =
C. !=
D. //
What is the correct answer ??
int a = 5/2;
int b = 5.0/2;
int c = 5 / 2.0;
int d = 5.0/2.0;
A) a = 2, b = 2, c = 2, d= 2
B) a = 2, b = 2.0, c = 2, d= 2.0
C) a = 2, b = 2.5, c = 2.5, d= 2.5
D) a = 2.5, b = 2.5, c = 2.5, d= 2.5
The modulus operator (%) can be used only with integers ??
A. True
B. False
C. None of these
D. Depends on the expression
The correct statement is ??
float a = 5/2;
float b = 5/2.0;
float c = 5.0/2;
float d = 5.0/2.0;
A) a=2.5, b=2.5, c=2.5, d=2.5
B) a=2, b=2.5, c=2.5, d=2.5
C) a=2.0, b=2.5, c=2.5, d=2.5
D) a=2.0, b=2.0, c=2.0, d=2.0
Which operator checks if the value of the left operand is greater than or equal to the value of the right operand ??
A. <=
B. >=
C. !=
D. !!
If both numerator and denominator of a division operation in C language are integers, then we get ??
A) Expected algebraic real value
B) Unexpected integer value
C) Compiler error.
D) None of the above
Operator In C Language
What is the output of this C code ??
int main()
{
int i = -5;
int k = i %4;
printf(“%d\n”, k);
}
A. Compile-time error
B. -1
C. 1
D. None
Choose a right statement ??
int var = 3.5;
A) a = 3.5
B) a = 3
C) a = 0
D) Compiler error
What is the output of this C code ??
int main()
{
int i = 5;
int l = i / -4;
int k = i % -4;
printf(“%d %d\n”, l, k);
return 0;
}
A. Compile-time error
B. -1 1
C. 1 -1
D. Run time error
Choose the right statement ??
int main()
{
int var = 3.5;;
printf(“%f”, var);
return 0;
}
A) 3.500000
B) 3
C) 3.5
D) 0.000000
What is the output of this C code ??
int main()
{
int i = 7;
i = i / 4;
printf(“%d\n”, i);
return 0;
}
A. Run time error
B. 1
C. 3
D. Compile time error
What is the output of the program ??
int main()
{
int a = 25%10;
printf(“%d”, a);
return 0;
}
A) 2.5
B) 2
C) 5
D) Compiler error
What is the value of x in this C code ??
void main()
{
int x = 4 *5 / 2 + 9;
}
A. 6.75
B. 1.85
C. 19
D. 3
Can you use C Modulo Division operator % with float and int ??
A) Only int variables = Okay
B) Only float variables = Okay
C) int or float combination = Okay
D) Numerator int variable, Denominator any variable = Okay
What is the output of this C code ??
void main()
{
int x = 4.3 % 2;
printf(“Value of x is %d”, x);
}
A. Value of x is 1.3
B. Value of x is 2
C. Value of x is 0.3
D. Compile time error
What is the output of the C program with Modulo Division operator with – or Negative numbers ??
int main()
{
int a = -25%-10;
int b = -25%10;
int c = 25%-10;
printf(“%d %d %d”, a, b, c);
return 0;
}
A) 5 -5 -5
B) 5 -5 5
C) -5 -5 5
D) 5 5 5
Operator In C Language
What is the output of this C code ??
void main()
{
int y = 3;
int x = 7 % 4 * 3 / 2;
printf(“Value of x is %d”, x);
}
A. Value of x is 1
B. Value of x is 2
C. Value of x is 3
D. Compile time error
What is the output of the program ??
int main()
{
float a = 45;
printf(“%f”, a);
return 0;
}
A) 45
B) 45.0
C) 45.000000
D) 0.000000
What is the output of this C code ??
void main()
{
int a = 5;
int b = ++a + a++ + –a;
printf(“Value of b is %d”, b);
}
A. Value of x is 16
B. Value of x is 21
C. Value of x is 15
D. Undefined behavior
What is the priority of operators *, / and % in C language ??
A) * > / > %
B) % > * > /
C) Both % = / , * are same
D) All three operators *, / and % are same
The precedence of arithmetic operators is (from highest to lowest) ??
A. %, *, /, +, –
B. %, +, /, *, –
C. +, -, %, *, /
D. %, +, -, *, /
In C language, which Operator group has more priority between (*, / and %) and (+, -) groups ??
A) Both groups share equal priority
B) (+, -) > (*, / and %)
C) (+, -) < (*, / and %)
D) None of the above
Which of the following is not an arithmetic operation ??
A. a *= 20;
B. a /= 30;
C. a %= 40;
D. a != 50;
Associativity of C Operators *, /, %, +, – and = is ??
A) Operators *, / and % have Left to Right Associativity. Operators + and – have Left to Right Associativity. Operator = has Right to Left Associativity
B) Operators *, / and % have Right to Left Associativity. Operators + and – have Left to Right Associativity. Operator = has Right to Left Associativity
C) Operators *, / and % have Right to Left Associativity. Operators + and – have Right to Left Associativity. Operator = has Right to Left Associativity
D) Operators *, / and % have Right to Left Associativity. Operators + and – have Right to Left Associativity. Operator = has Left to Right Associativity
Which of the following data type will throw an error on modulus operation(%) ??
A. char
B. short
C. float
D. int
The correct output of this C code is ??
int main()
{
int a = 20;
double b = 15.6;
int c;
c = a + b;
printf(“%d”, c);
}
A. 35
B. 36
C. 35.6
D. 30
Operator In C Language
Which operators are used to comparing the values of operands to produce logical value in C language ??
A. Logical operator
B. Relational operator
C. Assignment operator
D. None of the above
What is the output of this C code ??
int main()
{
int a = 20, b = 15, c = 5;
int d;
d = a == (b + c);
printf(“%d”, d);
}
A. 1
B. 40
C. 10
D. 5
What is/are the number of operand/operands needed to unary operator logical not(!) ??
A. 4
B. 3
C. 2
D. 1
What is the output of this C code ??
void main()
{
int x = 0;
if (x = 0)
printf(“Its zero\n”);
else
printf(“Its not zero\n”);
}
A. It’s not zero
B. Its zero
C. Run time error
D. None
While assigning a value to a variable, which operators are used to performing arithmetic operations ??
A. Logical operator
B. Assignment operator
C. Increment operator
D. Conditional operator
What is the output of this C code ??
void main()
{
int k = 8;
int x = 0 == 1 && k++;
printf(“%d%d\n”, x, k);
}
A. 0 9
B. 0 8
C. 1 9
D. 1 8
An operator used to check a condition and select a value depending on the value of the condition is called ??
A. Logical operator
B. Decrement operator
C. Conditional or Ternary operator
D. Bitwise operator
What is the output of this C code ??
void main()
{
char a = ‘a’;
int x = (a % 10)++;
printf(“%d\n”, x);
}
A. 6
B. Junk value
C. Compile-time error
D. 7
Which operators perform operations on data at binary-level ??
A. Logical operator
B. Bitwise operator
C. Additional operators
D. None of the above
What is the Priority among (*, /, %), (+, -) and (=) C Operators ??
A) (*, /, %) > (+, -) < (=)
B) (*, /, %) < (+, -) < (=)
C) (*, /, %) > (+, -) > (=)
D) (*, /, %) < (+, -) (+, -) == (=)
Operator In C Language
When applied to a variable, what does the unary “&” operator yield ??
A. The variable’s address
B. The variables right value
C. The variable’s binary form
D. The variable’s value
What is the output of the C statement ??
int main()
{
int a=0;
a = 4 + 4/2*5 + 20;
printf(“%d”, a);
return 0;
}
A) 40
B) 4
C) 34
D) 54
The operator “&” is used for ??
A. Bitwise AND
B. Bitwise OR
C. Logical AND
D. Logical OR
Related Posts
- Blockchain MCQs
- Operating System MCQs
- Artificial Intelligence MCQs
- Software Engineering MCQs
- Kotlin Multiple Choice Questions
- Java MCQs
- Android MCQs
- C Language Data Types MCQ