Operators Questions

Practice Operators MCQs with answers and explanations. Page 1 of 1.

Category
C# Programming
Topic
Operators
Page
1 / 1
Mode
Practice

Questions

Open any question to view the answer and explanation.

Predict the output of the following C#.NET code (pay close attention to post-increment and pre-increment on the same variable): int i, j = 1, k; for (i = 0; i < 5; i++) { k = j++ + ++j; Console.Write(k + " "); }
Open
View answer
C#.NET — Which of the following is NOT an arithmetic operator?
Open
View answer
C#.NET — Predict the output of the following ternary operator code: int a = 10, b = 20, c = 30; int res = a < b ? (a < c ? c : a) : b; Console.WriteLine(res);
Open
View answer
C#.NET — Identify the correct statements among the following operators: The conditional operator (?:) returns one of two values depending on a Boolean expression. The as operator is used to perform conversions between compatible reference types. The * operator is also used to declare pointer types and dereference pointers. The -> operator combines pointer dereferencing and member access. Brackets [ ] specify array indexing, while parentheses () are used for grouping and type casts.
Open
View answer
C#.NET — Predict the output of: Console.WriteLine(13 / 2 + " " + 13 % 2);
Open
View answer
C#.NET — Which of the following is correct about the Bitwise OR operator (|)?
Open
View answer
C#.NET — Which of the following is correct about the Bitwise XOR operator (^) ?
Open
View answer
C#.NET — Which of the following are NOT relational operators? = != Not <= <>=
Open
View answer
C#.NET — Evaluate and predict the output: int num = 1, z = 5; if (!(num <= 0)) Console.WriteLine(++num + z++ + " " + ++z); else Console.WriteLine(--num + z-- + " " + --z);
Open
View answer
C#.NET — Which of the following is NOT a bitwise operator?
Open
View answer
C#.NET — Which of the following is NOT an assignment operator?
Open
View answer
Bit operations in C# (Byte): turn OFF the 4th bit from the right (bit value 8) without changing other bits. Which statement performs this correctly?
Open
View answer
C# increment forms: which statements correctly increase variable a by exactly 1?
Open
View answer
C# bit test (Byte): check whether the 4th bit from the right (value 8) is ON. Which condition is correct?
Open
View answer
C# bitwise operations output — evaluate AND and XOR on bytes byte b1 = 0xF7; byte b2 = 0xAB; byte temp; temp = (byte)(b1 & b2); Console.Write(temp + ' '); temp = (byte)(b1 ^ b2); Console.WriteLine(temp);
Open
View answer
Logical operators in C#: select all that are logical (short-circuit or logical-not) operators from the list: 1) && 2) || 3) ! 4) Xor 5) %
Open
View answer
Evaluate the Boolean expression in C#: what is assigned to c? int a = 10; int b = 20; bool c; c = !(a > b);
Open
View answer
Understanding the bitwise AND (&) operator in C#: which uses are correct? 1) Invert a bit 2) Put a bit ON (set to 1) 3) Put a bit OFF (clear to 0) 4) Check whether a bit is ON 5) Check whether a bit is OFF
Open
View answer
C# bitwise NOT, shifts, and promotions — predict the output byte b1 = 0xAB; byte b2 = 0x99; byte temp; temp = (byte)~b2; Console.Write(temp + ' '); temp = (byte)(b1 << b2); Console.Write(temp + ' '); temp = (byte)(b2 >> 2); Console.WriteLine(temp);
Open
View answer
Boolean to integer via Convert in C#: what value is assigned? d = Convert.ToInt32(!(30 < 20));
Open
View answer

Practice smarter

Solve a few questions daily and revisit weak topics regularly to improve accuracy.