LearnFrenzy
Sign in Take a free test

Operators and Expressions · Exercise 1 of 4

Operators and Expressions Operators MCQ

  • 12 questions
  • Page 1 of 2
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Twelve multiple-choice questions on arithmetic, increment and decrement, precedence and associativity, relational and logical operators, the comma operator, sizeof and undefined expressions. Pick an option to check your answer instantly.

Question 1 Easy

What is the value of the expression 7 / 2 in C?

A 3.5
B 3
C 4
D 3.0
Question page & discussion
Question 2 Medium

What is the value of -7 % 3?

A 2
B -1
C 1
D -2
Question page & discussion
Question 3 Easy

What is 2 + 3 * 4?

A 20
B 14
C 24
D 9
Question page & discussion
Question 4 Easy

How is a = b = c = 0; grouped?

A ((a = b) = c) = 0
B a = (b = (c = 0))
C It is a syntax error
D Only a is set
Question page & discussion
Question 5 Medium

What is the value of i after int i = 5; i = i++;?

A 5
B 6
C Undefined behaviour – i is modified twice without a sequence point
D 7
Question page & discussion
Question 6 Easy

What is the type and value of (5 > 3)?

A bool true
B int 1
C char 'T'
D Any non-zero value
Question page & discussion
Question 7 Medium

Which statement about sizeof is true?

A It is a library function from <stdlib.h>
B It is an operator, usually evaluated at compile time; its operand is not executed (except for VLAs)
C It always needs brackets
D It returns an int
Question page & discussion
Question 8 Medium

What is the value of x after int x = (4, 7, 9);?

A 4
B 7
C 9
D 20
Question page & discussion
Question 9 Easy

How does C group a && b || c?

A a && (b || c)
B (a && b) || c
C Left to right with equal priority
D It is an error
Question page & discussion
Question 10 Easy

After int x = 5; int y = x++ + 1;, what are x and y?

A x = 6, y = 7
B x = 6, y = 6
C x = 5, y = 6
D x = 5, y = 7
Question page & discussion

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links