MCQOPTIONS
Saved Bookmarks
This section includes 11 Mcqs, each offering curated multiple-choice questions to sharpen your Arrays knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the following loop correctly prints the elements of the array? |
| A. | do { Console.WriteLine(( char ) i); } while ( int i = 0 ; i < arr; i++); |
| B. | foreach ( int i in arr) { Console.WriteLine(( char ) i); } |
| C. | for ( int i = 0 ; i < arr; i++) { Console.WriteLine(( char ) i); } |
| D. | while ( int i = 0 ; i < arr; i++) { Console.WriteLine(( char ) i); } |
| Answer» C. for ( int i = 0 ; i < arr; i++) { Console.WriteLine(( char ) i); } | |
| 2. |
What will be the output of the code snippet given below? |
| A. | 1 2 3 4 5 6 7 8 9 10 |
| B. | 1 2 3 4 |
| C. | 0 1 2 3 4 5 6 7 8 9 10 |
| D. | 4 5 6 7 8 9 10 |
| Answer» D. 4 5 6 7 8 9 10 | |
| 3. |
The C#.NET code snippet given below generates ____ numbers series as output? |
| A. | Prime |
| B. | Fibonacci |
| C. | Palindrome |
| D. | Odd |
| Answer» C. Palindrome | |
| 4. |
Which of the following can be used to terminate a while loop and transfer control outside the loop? |
| A. | 1, 3 |
| B. | 2, 4 |
| C. | 3, 5 |
| D. | 4, 5 |
| Answer» E. | |
| 5. |
Which of the following code snippets are the correct way to determine whether a is Odd or Even? |
| A. | 1, 3 |
| B. | 1 Only |
| C. | 2, 3 |
| D. | 4 Only |
| Answer» C. 2, 3 | |
| 6. |
Which of the following is the correct way to rewrite the following C#.NET code snippet given below? |
| A. | int i = 0 ; do { Console.WriteLine(i); } until (i <= 10 ); |
| B. | int i; for (i = 0 ; i <= 10 ; i++) Console.WriteLine(i); |
| C. | int i = 0 ; while (i <= 11 ) { Console.WriteLine(i); i += 1 ; } |
| D. | int i = 0 ; do while ( i <= 10 ) { Console.WriteLine(i); i += 1 ; } |
| Answer» C. int i = 0 ; while (i <= 11 ) { Console.WriteLine(i); i += 1 ; } | |
| 7. |
What is the output of the C#.NET code snippet given below? |
| A. | red |
| B. | blue |
| C. | 0 |
| D. | 1 |
| Answer» C. 0 | |
| 8. |
Which of the following is the correct output for the C#.NET program given below? |
| A. | 20 16 12 84 0 -4 -8 |
| B. | 20 16 12 8 4 0 |
| C. | 20 16 12 8 4 0 -4 -8 -12 |
| D. | 16 12 8 4 0 |
| Answer» D. 16 12 8 4 0 | |
| 9. |
What does the following C#.NET code snippet will print? |
| A. | Prints 1 to 9 |
| B. | Prints 0 to 8 |
| C. | Prints 2 to 8 |
| D. | Prints 2 to 9 |
| Answer» B. Prints 0 to 8 | |
| 10. |
How many times the while loop will get executed if a short int is 2 byte wide? |
| A. | Infinite times |
| B. | 255 times |
| C. | 256 times |
| D. | 254 times |
| Answer» C. 256 times | |
| 11. |
How many times "IndiaBIX" is get printed? |
| A. | Infinite times |
| B. | 11 times |
| C. | 0 times |
| D. | 10 times |
| Answer» D. 10 times | |