NEW
Font size
WorksheetsICT4-CP: C-Sharp
Total questions: 50
Worksheet time: 25mins
The result of p | q if p is 0 and q is 1 will be:
0
1
a negative number
an error
If A = 60; and B = 13, then A&B in binary format will be:
0011 0001
0011 1101
0000 1100
0000 1100
Assume variable A holds 60 and variable B holds 13, then (A ^ B) equals:
12
61
-61
49
If the left operands value is moved right by the number of bits specified by the right operand, the bitwise
operator is.
Binary Right Shift Operator
Binary Left Shift Operator
Binary Ones Complement Operator
Binary XOR Operator
Which of the following are Assignment operators in C#?
1, 2, 3
1, 3, 4
2, 4, 5
3, 4, 5
Which of the following operator returns the address of a variable in C#?
? :
^
&
>
Which of the following operator assigns values from right side operands to left side operand in C#?
%=
=
>>=
&=
Which of the following operator returns the type of a class in C# ?
sizeof
typeof
&
*
Which of the following operator creates a pointer to a variable in C# ?
sizeof
typeof
&
*
The assignment operators cannot be overloaded.
true
false
Neither true or false.
There are no correct choices.
An if statement can have
One else
More than one else
Nested if else statements
All of the choices are correct
This is used to select from multiple different blocks of code.
if statement
if else statement
if else if else statement
switch statement
It allows to specify the code that should run, if the condition in the first if statement evaluates to false.
if statement
if else statement
if else if else statement
switch statement
This is used to execute some code ONCE, only when a specified condition is true.
if statement
if else statement
if else if else statement
switch statement
It allows use to execute code based on a predefined set choices.
if statement
if else statement
if else if else statement
switch statement
It is used to control the flow of our programs and allow us to run certain blocks of code once, only if a
certain condition is true.
expression
constant constructs
sequential constructs
decision constructs
It allows to specify the code that should run, if the condition in the first if statement evaluates to false.
if statement
if else statement
if else if else statement
switch statement
It selects a statement for execution based on the value of a Boolean expression.
if statement
if else statement
if else if else statement
switch statement
It executes only one statement from multiple given statements associated with conditions.
if statement
if else statement
if else if else statement
switch statement
It terminates the case in the switch statement where it is placed.
end
go to
break
continue
A loop statement in C# that repeatedly executes a target statement as long as a given condition is true.
do...while loop
for loop
nested loop
while loop
Control structure that allows you to efficiently write a loop that needs to execute a specific number of
times.
do...while loop
for loop
nested loop
while loop
A loop statement that checks its condition at the end of the loop.
do...while loop
for loop
nested loop
while loop
A loop statement in C# that allows to use one loop inside another loop.
do...while loop
for loop
nested loop
while loop
It terminates the switch statement and transfers execution to the statement immediately following the
switch.
condition statement
increment statement
break statement
continue statement
It forces the next iteration of the loop to take place, skipping any code in between.
condition statement
increment statement
break statement
continue statement
It is an endless loop by leaving the conditional expression empty.
finite loop
infinite loop
increment loop
decrement loop
It can be used to terminate a case in the switch statement.
condition statement
increment statement
break statement
continue statement
The init step is executed and the condition is evaluated before it jumps back to the increment statement.
do...while loop
for loop
nested loop
while loop
A loop statement that is guaranteed to execute at least one time.
do...while loop
for loop
nested loop
while loop
What will be the output of the code snippet given below?
10
20
30
Compile Error / Syntax Error
Which of the following statements are correct about the following code snippet?
1, 3
2, 4
4, 5
1, 4
Which of the following is NOT an Arithmetic operator in C#?
**
+
/
%
Which of the following are NOT Relational operators in C#?
1, 3
2, 4
3, 5
4, 5
Which of the following are Logical operators in C#?
1, 2, 3
1, 3, 4
2, 4, 5
3, 4, 5
The operator shown by "x % y" is called:
percentage
conversion specifier
modulus
multiplication
What expression denotes "x is not equal to y"?
x//y
x
x neg y
x!=y
What is the expression in C# for "less than or equal to"?
<
<=
>=
<==
What is the logical "or" operator?
&&
!!
||
OR
The operator shown by "x/y" is
multiplication
division
addition
negation
Which of the following preprocessor directive specifies the end of a conditional directive in C#?
elif
endif
if
else
Which of the following preprocessor directive lets you modify the compiler's line number and optionally the
file name output for errors and warnings in C#?
elif
endif
line
region
It is a decrement operator that decreases integer value by one.
> =
! =
- -
= =
It checks if the values of two operands are equal or not and if values are not equal then condition becomes
true.
> =
! =
- -
= =
It is called a Modulus Operator and the remainder of after an integer division.
%
/
- -
||
It is an operator that divides numerator by de-numerator.
%
/
- -
||
It is an operator that is used to reverse the logical state of its operand, and if a condition is true then the
operator will make false.
%
! =
- -
!
It is an operator that if any of the two operands is non zero then condition becomes true.
%
/
&&
||
It is an operator that If both the operands are non zero, then condition becomes true.
%
/
&&
||
It is an increment operator that increases integer value by one
> =
++
--
!=
