MCQOPTIONS
Saved Bookmarks
This section includes 52 Mcqs, each offering curated multiple-choice questions to sharpen your C Sharp Programming knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the following statements are correct about the following code snippet? int a = 10; int b = 20; bool c; c = !(a > b);There is no error in the code snippet. An error will be reported since ! can work only with an int. A value 1 will be assigned to c. A value True will be assigned to c. A value False will be assigned to c. |
| A. | 1, 3 |
| B. | 2, 4 |
| C. | 4, 5 |
| D. | 1, 4 |
| E. | None of these |
| Answer» E. None of these | |
| 2. |
What will the following expression evaluate to? !true && !false |
| A. | True |
| B. | False |
| C. | Error |
| D. | None of the mentioned |
| Answer» C. Error | |
| 3. |
What will the following expression evaluate to? (true && false) || (!true) |
| A. | True |
| B. | False |
| C. | Error |
| D. | None of the mentioned |
| E. | || (!true)a) Trueb) Falsec) Errord) None of the mentioned |
| Answer» C. Error | |
| 4. |
What will the following expression evaluate to? true || false |
| A. | True |
| B. | False |
| C. | Error |
| D. | None of the mentioned |
| Answer» B. False | |
| 5. |
What will the following expression evaluate to? true && false |
| A. | True |
| B. | False |
| C. | Error |
| D. | None of the mentioned |
| Answer» C. Error | |
| 6. |
The boolean operator && only result in true when both the values are true? |
| A. | True |
| B. | False |
| Answer» B. False | |
| 7. |
Which of the following is a valid boolean operator?a) and(&&)b) or(| |
| A. | and(&&) |
| B. | or(||) |
| C. | not(!) |
| D. | All of the mentioned |
| Answer» E. | |
| 8. |
Boolean opeartors are also known as logical operators. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 9. |
How many operands does the >= operator require? |
| A. | 1 |
| B. | 2 |
| C. | 3 |
| D. | 4 |
| Answer» C. 3 | |
| 10. |
Is there a difference between the = and the == operators? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 11. |
What is the purpose of the |
| A. | Bitwise AND |
| B. | Bitwise Right Shift |
| C. | Bitwise Left Shift |
| D. | Bitwise OR |
| Answer» D. Bitwise OR | |
| 12. |
What is the name of the ^ operator? |
| A. | Bitwise XNOR |
| B. | Bitwise NAND |
| C. | Bitwise XOR |
| D. | Bitwise AND |
| Answer» D. Bitwise AND | |
| 13. |
What is the name of the ~ operator? |
| A. | Bitwise NOT |
| B. | Logical NOT |
| C. | Bitwise SHIFT |
| D. | Pointer Address |
| Answer» B. Logical NOT | |
| 14. |
What is the name of the | operator? |
| A. | Logical OR |
| B. | Bitwise OR |
| C. | Logical AND |
| D. | Bitwise AND |
| Answer» C. Logical AND | |
| 15. |
What is the difference between ternary operators and unary operators? |
| A. | Ternary Operators work with 1 operand while unary operators work with 3 operands |
| B. | Ternary Operators work with 3 operands while unary operators work with 1 operand |
| C. | Ternary Operators work with 2 operands while unary operators work with 3 operands |
| D. | Ternary Operators work with 4 operands while unary operators work with 1 operand |
| Answer» C. Ternary Operators work with 2 operands while unary operators work with 3 operands | |
| 16. |
What is the output of the following program if ‘a’ and ‘b’ are both supplied with 5V? |
| A. | Equal |
| B. | Not Equal |
| C. | Runtime Error |
| D. | Compilation ErrorView Answer |
| Answer» B. Not Equal | |
| 17. |
The maximum non zero value for FLOAT is ______________ |
| A. | 3.402823466E+38 |
| B. | 3.402823466E+37 |
| C. | 3.402823466E+39 |
| D. | 3.402823466E+35 |
| Answer» B. 3.402823466E+37 | |
| 18. |
‘fetchrow_hashref()’ returns a reference to the hash of row values keyed by what? |
| A. | row name |
| B. | column name |
| C. | table name |
| D. | database name |
| Answer» C. table name | |
| 19. |
Which function returns a reference to hash of row values? |
| A. | fetchrow_array() |
| B. | fetchrow_arrayref() |
| C. | fetch() |
| D. | fetchrow_hashref() |
| Answer» E. | |
| 20. |
Which function returns an array of row values? |
| A. | fetchrow_array() |
| B. | fetchrow_arrayref() |
| C. | fetch() |
| D. | fetchrow_hashref() |
| Answer» B. fetchrow_arrayref() | |
| 21. |
What does RTF refer to? |
| A. | Rich Text Format |
| B. | Right Text Format |
| C. | Rich Text Function |
| D. | Right Text Function |
| Answer» B. Right Text Format | |
| 22. |
Which operator compares sounds? |
| A. | MATCH SOUNDS |
| B. | CHECK SOUNDS |
| C. | SOUNDS LIKE |
| D. | SOUNDS SIMILAR |
| Answer» D. SOUNDS SIMILAR | |
| 23. |
The right shift operator is _____________ |
| A. | >> |
| B. | << |
| C. | < |
| D. | > |
| Answer» B. << | |
| 24. |
Which operator is used to return value from JSON columns after evaluating the path and unquoting the result? |
| A. | -> |
| B. | ->> |
| C. | << |
| D. | >> |
| Answer» C. << | |
| 25. |
Determine output:public class Test{static int i = 5;public static void main(String... args){System.out.println(i++);System.out.println(i);System.out.println(++i);System.out.println(++i+i++);}} |
| A. | 6 6 16 |
| B. | 7 6 16 |
| C. | 6 7 16 |
| D. | 6 6 16 |
| E. | one of these |
| Answer» D. 6 6 16 | |
| 26. |
What will be the output?if(1 + 1 + 1 + 1 + 1 == 5){System.out.print("TRUE");}else{System.out.print("FLASE");} |
| A. | RUE |
| B. | ALSE |
| C. | ompiler Error |
| D. | one of these |
| Answer» B. ALSE | |
| 27. |
What is the output of the following program ?class Numbers{public static void main(String args[]){int a=20, b=10;if((a < b) && (b++ < 25)){System.out.println("This is any language logic");}System.out.println(b);}} |
| A. | 2 |
| B. | 1 |
| C. | 0 |
| D. | ompilation Error |
| Answer» D. ompilation Error | |
| 28. |
int ++a = 100 ;System.out.println( ++a ) ;What will be the output of the above fraction of code ? |
| A. | 00 |
| B. | isplays error as ++a is not enclosed in double quotes in println statement |
| C. | ompiler displays error as ++a is not a valid identifier |
| D. | one of these |
| Answer» D. one of these | |
| 29. |
Determine output:public class Test{public static void main(String... args){int a=5 , b=6, c=7;System.out.println("Value is "+ b + c);System.out.println(a + b + c);System.out.println("String " + (b+c));}} |
| A. | alue is 67 18 String 13 |
| B. | alue is 13 18 String 13 |
| C. | alue is 13 18 String |
| D. | ompilation fails |
| E. | one of these |
| Answer» B. alue is 13 18 String 13 | |
| 30. |
What will be the output after compiling and running following code?1. public class Test{2.public static void main(String... args){3.int x =5;4.x *= 3 + 7;5.System.out.println(x);6.}7. } |
| A. | 2 |
| B. | 0 |
| C. | 0 |
| D. | ompilation fails with an error at line 4 |
| E. | one of these |
| Answer» C. 0 | |
| 31. |
What will be the output?public class Test{public static void main(String args[]){int a = 42;double b = 42.25;System.out.print((a%10)+" "+(b%10));}} |
| A. | 2 42.5 |
| B. | 2.5 |
| C. | .2 4.225 |
| D. | 4.225 |
| E. | ompilation Error |
| Answer» C. .2 4.225 | |
| 32. |
Which of the following is NOT an Assignment operator in C#.NET? |
| A. | \= |
| B. | /= |
| C. | *= |
| D. | += |
| E. | %= |
| Answer» B. /= | |
| 33. |
Which of the following is NOT an Assignment operator in C#.NET? |
| A. | \= |
| B. | /= |
| C. | *= |
| D. | += |
| Answer» B. /= | |
| 34. |
What will be the output of the C#.NET code snippet given below? byte b1 = 0xAB; byte b2 = 0x99; byte temp; temp = (byte)~b2; Console.Write(temp + " "); temp = (byte)(b1 > 2); Console.WriteLine(temp); |
| A. | 102 1 38 |
| B. | 108 0 32 |
| C. | 102 0 38 |
| D. | 1 0 1 |
| Answer» D. 1 0 1 | |
| 35. |
Which of the following statements is correct about Bitwise | operator used in C#.NET? |
| A. | The | operator can be used to put OFF a bit. |
| B. | The | operator can be used to Invert a bit. |
| C. | The | operator can be used to check whether a bit is ON. |
| D. | The | operator can be used to check whether a bit is OFF. |
| Answer» E. | |
| 36. |
Suppose n is a variable of the type Byte and we wish, to check whether its fourth bit (from right) is ON or OFF. Which of the following statements will do this correctly? |
| A. | if ((n&16) == 16) Console.WriteLine("Fourth bit is ON"); |
| B. | if ((n&8) == 8) Console.WriteLine("Fourth bit is ON"); |
| C. | if ((n ! 8) == 8) Console.WriteLine("Fourth bit is ON"); |
| D. | if ((n ^ 8) == 8) Console.WriteLine("Fourth bit is ON"); |
| Answer» C. if ((n ! 8) == 8) Console.WriteLine("Fourth bit is ON"); | |
| 37. |
Which of the following is the correct output for the C#.NET code snippet given below? Console.WriteLine(13 / 2 + " " + 13 % 2); |
| A. | 6.5 1 |
| B. | 6.5 0 |
| C. | 6 0 |
| D. | 6 1 |
| Answer» E. | |
| 38. |
Which of the following statements are correct? The conditional operator (?:) returns one of two values depending on the value of a Boolean expression. The as operator in C#.NET is used to perform conversions between compatible reference types. The &* operator is also used to declare pointer types and to dereference pointers. The -> operator combines pointer dereferencing and member access. In addition to being used to specify the order of operations in an expression, brackets [ ] are used to specify casts or type conversions. |
| A. | 1, 2, 4 |
| B. | 2, 3, 5 |
| C. | 3, 4, 5 |
| D. | 1, 3, 5 |
| Answer» B. 2, 3, 5 | |
| 39. |
Suppose n is a variable of the type Byte and we wish to put OFF its fourth bit (from right) without disturbing any other bits. Which of the following statements will do this correctly? |
| A. | n = n && HF7 |
| B. | n = n & 16 |
| C. | n = n & 0xF7 |
| D. | n = n & HexF7 |
| Answer» D. n = n & HexF7 | |
| 40. |
Which of the following are Logical operators in C#.NET? && || ! Xor % |
| A. | 1, 2, 3 |
| B. | 1, 3, 4 |
| C. | 2, 4, 5 |
| D. | 3, 4, 5 |
| Answer» B. 1, 3, 4 | |
| 41. |
Which of the following statements are correct about the following code snippet? int a = 10; int b = 20; bool c; c = !(a > b); There is no error in the code snippet. An error will be reported since ! can work only with an int. A value 1 will be assigned to c. A value True will be assigned to c. A value False will be assigned to c. |
| A. | 1, 3 |
| B. | 2, 4 |
| C. | 4, 5 |
| D. | 1, 4 |
| Answer» E. | |
| 42. |
Which of the following statements are correct about the Bitwise & operator used in C#.NET? The & operator can be used to Invert a bit. The & operator can be used to put ON a bit. The & operator can be used to put OFF a bit. The & operator can be used to check whether a bit is ON. The & operator can be used to check whether a bit is OFF. |
| A. | 1, 2, 4 |
| B. | 2, 3, 5 |
| C. | 3, 4 |
| D. | 3, 4, 5 |
| Answer» E. | |
| 43. |
What will be the output of the C#.NET code snippet given below? int a = 10, b = 20, c = 30; int res = a < b ? a < c ? c : a : b; Console.WriteLine(res); |
| A. | 10 |
| B. | 20 |
| C. | 30 |
| D. | Compile Error / Syntax Error |
| Answer» D. Compile Error / Syntax Error | |
| 44. |
Which of the following statements is correct about Bitwise ^ operator used in C#.NET? |
| A. | The ^ operator can be used to put ON a bit. |
| B. | The ^ operator can be used to put OFF a bit. |
| C. | The ^ operator can be used to Invert a bit. |
| D. | The ^ operator can be used to check whether a bit is ON. |
| Answer» D. The ^ operator can be used to check whether a bit is ON. | |
| 45. |
Which of the following is NOT a Bitwise operator in C#.NET? |
| A. | & |
| B. | | |
| C. | << |
| D. | ^ |
| Answer» D. ^ | |
| 46. |
What will be the output of the C#.NET code snippet given below? byte b1 = 0xF7; byte b2 = 0xAB; byte temp; temp = (byte)(b1 & b2); Console.Write (temp + " "); temp = (byte)(b1^b2); Console.WriteLine(temp); |
| A. | 163 92 |
| B. | 92 163 |
| C. | 192 63 |
| D. | 0 1 |
| Answer» B. 92 163 | |
| 47. |
What will be the output of the C#.NET code snippet given below? int i, j = 1, k; for (i = 0; i < 5; i++) { k = j++ + ++j; Console.Write(k + " "); } |
| A. | 8 4 16 12 20 |
| B. | 4 8 12 16 20 |
| C. | 4 8 16 32 64 |
| D. | 2 4 6 8 10 |
| Answer» C. 4 8 16 32 64 | |
| 48. |
What will be the output of the C#.NET code snippet given below? int num = 1, z = 5; if (!(num |
| A. | 5 6 |
| B. | 6 5 |
| C. | 6 6 |
| D. | 7 7 |
| Answer» E. | |
| 49. |
Which of the following statements is correct about the C#.NET code snippet given below? int d; d = Convert.ToInt32( !(30 < 20) ); |
| A. | A value 0 will be assigned to d. |
| B. | A value 1 will be assigned to d. |
| C. | A value -1 will be assigned to d. |
| D. | The code reports an error. |
| Answer» C. A value -1 will be assigned to d. | |
| 50. |
Which of the following are NOT Relational operators in C#.NET? >= != Not |
| A. | 1, 3 |
| B. | 2, 4 |
| C. | 3, 5 |
| D. | 4, 5 |
| Answer» D. 4, 5 | |