Operators
Test
Model Test
Ebook
Test on C#.Net framwork 4 Sep 30
CSharp Model Test 1
CSharp Model Test Three
Index
C#.NET Home
Datatype
59
Basic
28
Methods
5
Arrays
3
Object-Oriented Programming
11
Operators
53
Control Structure
18
Schools
Ebook
Question:
What is the result of the expression 7 / 2 in C#?
A
3.5
B
3
C
4
D
2
Note:
In C#, integer division truncates the decimal portion, so 7 / 2 results in 3.
Show answer
Show Note
Report
Question:
Which operator is used to check if a variable is of a certain type?
A
is
B
as
C
type
D
typeof
Note:
The is operator checks whether an object is compatible with a given type.
Show answer
Show Note
Report
Question:
What will the expression 5.0 / 2 evaluate to?
A
2
B
2.5
C
3
D
0
Note:
When performing division with at least one floating-point number, the result is a floating-point number.
Show answer
Show Note
Report
Question:
Which operator is used to perform a logical AND operation?
A
&
B
&&
C
and
D
||
Note:
The && operator is a short-circuit logical AND that evaluates the second operand only if the first is true.
Show answer
Show Note
Report
Question:
What does the operator | do?
A
Performs logical OR
B
Performs bitwise OR
C
Performs both Logical and bitwise OR
D
None
Note:
The | operator performs a bitwise OR operation on two integral types.
Show answer
Show Note
Report
Question:
What is the output of 3 ^ 2?
A
1
B
5
C
0
D
6
Note:
The ^ operator performs a bitwise XOR operation; hence, 3 ^ 2 results in 1 (binary 11 ^ 10 = 01).
Show answer
Show Note
Report
Question:
What does the ?? operator do?
A
Checks for equality
B
Returns the left operand if not null, otherwise the right operand
C
Performs logical negation
D
None
Note:
The ?? operator is known as the null-coalescing operator.
Show answer
Show Note
Report
Question:
Which operator has the highest precedence in C#?
A
+
B
*
C
/
D
-
Note:
Multiplication and division have higher precedence than addition and subtraction.
Show answer
Show Note
Report
Question:
What is the result of 1 << 3
A
1
B
2
C
8
D
4
Note:
The left shift operator << shifts bits to the left, effectively multiplying the number by 2 for each shift.
Show answer
Show Note
Report
Question:
What is the output of the expression 5 % 2?
A
1
B
2
C
0
D
5
Note:
The modulo operator % returns the remainder of the division.
Show answer
Show Note
Report
First
Prev
1
2
3
Next
Last
/6
Go
Schools
App Store
Whiteboard
Blogs
Quiz
Test
Apply Course
Games
Freelancers
Professionals
Newspapers
Terms
Privacy
Copyright © 2024. Powered by
Intellect Software Ltd