Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Tests  >  Programming and Data Structures  >  Test: Operators in C - Computer Science Engineering (CSE) MCQ

Test: Operators in C - Computer Science Engineering (CSE) MCQ


Test Description

10 Questions MCQ Test Programming and Data Structures - Test: Operators in C

Test: Operators in C for Computer Science Engineering (CSE) 2024 is part of Programming and Data Structures preparation. The Test: Operators in C questions and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus.The Test: Operators in C MCQs are made for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: Operators in C below.
Solutions of Test: Operators in C questions in English are available as part of our Programming and Data Structures for Computer Science Engineering (CSE) & Test: Operators in C solutions in Hindi for Programming and Data Structures course. Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free. Attempt Test: Operators in C | 10 questions in 30 minutes | Mock test for Computer Science Engineering (CSE) preparation | Free important questions MCQ to study Programming and Data Structures for Computer Science Engineering (CSE) Exam | Download free PDF with solutions
Test: Operators in C - Question 1

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

Detailed Solution for Test: Operators in C - Question 1

Explanation:
- The || operator is known as the logical OR operator. It returns true if at least one of its components evaluates to true, and false otherwise.
- In an expression involving the || operator, evaluation takes place from left to right. This means that the components on the left side will be evaluated first, and if any of them evaluate to true, the evaluation will stop and the overall expression will return true. If none of the components on the left side evaluate to true, the evaluation will continue with the components on the right side.
- However, if one of the components evaluates to true, the evaluation will stop and the overall expression will return true. This means that option II is correct.
- Option IV is also correct because evaluation takes place from left to right.

Therefore, the correct answer is 4. II and IV.

Test: Operators in C - Question 2

Which operator has the lowest priority?

1 Crore+ students have signed up on EduRev. Have you? Download the App
Test: Operators in C - Question 3

Determine output:

void main()
{
      int c = - -2; 
      printf("c=%d", c); 
}

Detailed Solution for Test: Operators in C - Question 3

In this C program, the expression - -2 involves the use of the unary minus operator (-) applied twice to the number 2.

- The first - operator negates the number 2, resulting in -2.
- The second - operator negates -2, which effectively makes it positive again, resulting in 2.

So, the variable c is assigned the value 2, and the output of the printf statement is c=2, which corresponds to Option C.

Test: Operators in C - Question 4

Which of the following comments about the ++ operator are correct?

Test: Operators in C - Question 5

Which of the following operator takes only integer operands?

Detailed Solution for Test: Operators in C - Question 5

Two integers are taken to be input

Test: Operators in C - Question 6

In C programming language, which of the following type of operators have the highest precedence

Test: Operators in C - Question 7

Determine output
void main()
{
      int i=0, j=1, k=2, m;
      m = i++ || j++ || k++;
      printf("%d %d %d %d", m, i, j, k);
}

Detailed Solution for Test: Operators in C - Question 7

In an expression involving || operator, evaluation takes place from left to right and will be stopped if one of its components evaluates to true(a non zero value).
So in the given expression m = i++ || j++ || k++.
It will be stop at j and assign the current value of j in m.
therefore m = 1 , i = 1, j = 2 and k = 2 (since k++ will not encounter. so its value remain 2)

Test: Operators in C - Question 8

What will be the output of this program on an implementation where int occupies 2 bytes?
#include <stdio.h>
void main()
{
      int i = 3;
      int j;
      j = sizeof(++i + ++i);
      printf("i=%d j=%d", i, j);
}

Detailed Solution for Test: Operators in C - Question 8

Evaluating ++i + ++i would produce undefined behavior, but the operand of sizeof is not evaluated, so i remains 3 throughout the program. The type of the expression (int) is reduced at compile time, and the size of this type (2) is assigned to j.

Test: Operators in C - Question 9

Determine output:
void main()

      int i=10; 
      i = !i>14; 
      printf("i=%d", i); 
}

Detailed Solution for Test: Operators in C - Question 9

In the expression !i>14 , NOT (!) operator has more precedence than ' >' symbol. ! is a unary logical operator. !i (!10) is 0 (not of true is false). 0>14 is false (zero).

Test: Operators in C - Question 10

What will be the output of the following program?
void main()
{
      int a, b, c, d;
      a = 3;
      b = 5;
      c = a, b;
      d = (a, b);
      printf("c=%d d=%d", c, d);
}

Detailed Solution for Test: Operators in C - Question 10

The comma operator evaluates both of its operands and produces the value of the second. It also has lower precedence than assignment. Hence c = a, b is equivalent to c = a, while d = (a, b) is equivalent to d = b.

119 docs|30 tests
Information about Test: Operators in C Page
In this test you can find the Exam questions for Test: Operators in C solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Operators in C, EduRev gives you an ample number of Online tests for practice

Top Courses for Computer Science Engineering (CSE)

Download as PDF

Top Courses for Computer Science Engineering (CSE)