

MCQOPTIONS
Saved Bookmarks
This section includes 20 Mcqs, each offering curated multiple-choice questions to sharpen your Javascript knowledge and support exam preparation. Choose a topic below to get started.
1. |
What will the following code do? |
A. | Nothing |
B. | j=0 & i=5 |
C. | Error |
D. | Cannot be determinedView Answer |
Answer» C. Error | |
2. |
How do we break from an infinite loop without keeping a break statement within the loop? |
A. | Press Ctrl+C |
B. | Press Ctrl+Z |
C. | Loop won’t be terminated |
D. | Press Ctrl+X |
Answer» B. Press Ctrl+Z | |
3. |
What will be the output for the following code? |
A. | i=0,k=1 |
B. | i=0,k=0 |
C. | i=1,k=0 |
D. | i=1,k=1View Answer |
Answer» B. i=0,k=0 | |
4. |
There can be multiple decision variables for while loop. |
A. | True |
B. | False |
Answer» B. False | |
5. |
A for-loop can have multiple index values. |
A. | True |
B. | False |
Answer» B. False | |
6. |
What is the nature of the following code? |
A. | j=0 & i=1 |
B. | j=1 & i=0 |
C. | i=8 & j=36 |
D. | ErrorView Answer |
Answer» B. j=1 & i=0 | |
7. |
How many times will the following loop run? |
A. | No output due to some error |
B. | 1 times |
C. | 0 times |
D. | 3 timesView Answer |
Answer» D. 3 timesView Answer | |
8. |
A break statement will leave the outer loop. |
A. | True |
B. | False |
Answer» C. | |
9. |
What is the size of i after the following code is run in MATLAB? |
A. | No output |
B. | 0*0 |
C. | i=-1 |
D. | ErrorView Answer |
Answer» C. i=-1 | |
10. |
What is the default increment value in a for-loop? |
A. | 0 |
B. | 1 |
C. | An increment value is necessary |
D. | 0/1 |
Answer» C. An increment value is necessary | |
11. |
What\'s wrong? (x = 4 && y = 5) ? (a = 5) ; (b = 6); |
A. | the first semicolon should be a colon |
B. | the question mark should be an equal sign |
C. | the conditional operator is only used with apstrings |
D. | there are too many variables in the statement |
Answer» B. the question mark should be an equal sign | |
12. |
What\'s wrong? for (int k = 2, k <=12, k ) |
A. | the variable must always be the letter i when using a for loop |
B. | the increment should always be k |
C. | the commas should be semicolons |
D. | there should be a semicolon at the end of the statement |
Answer» D. there should be a semicolon at the end of the statement | |
13. |
Which looping process checks the test condition at the end of the loop? |
A. | while |
B. | for |
C. | no looping process checks the test condition at the end |
D. | do-while |
Answer» E. | |
14. |
ONE_OF_THE_SPECIAL_FEATURE_OF_AN_INTERPRETER_IN_REFERENCE_WITH_THE_FOR_LOOP_IS_THAT____________?$ |
A. | Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property |
B. | The iterations can be infinite when an interpreter is used |
C. | The body of the loop is executed only once |
D. | the iteration is finite when an interpreter is used |
Answer» E. | |
15. |
No_output_due_to_some_error$ |
A. | 1 times |
B. | 0 times |
C. | 3 times |
Answer» B. 0 times | |
16. |
j=0_&_i=1 |
A. | j=1 & i=0 |
B. | i=8 & j=36 |
C. | Error |
Answer» C. Error | |
17. |
A break statement will leave the outer loop? |
A. | True |
B. | False |
Answer» B. False | |
18. |
No, this will throw an exception as only numerics can be used in a for loop |
A. | No, this will not iterate |
B. | Yes, this will work |
C. | No, this will result in a runtime error with the message “Cannot use Linked List” |
Answer» B. Yes, this will work | |
19. |
No output will be shown |
A. | a=10; |
B. | a=80 |
C. | Error in the code |
Answer» C. Error in the code | |
20. |
What are the three important manipulations done in a for loop on a loop variable? |
A. | Updation, Incrementation, Initialization |
B. | Initialization,Testing, Updation |
C. | Testing, Updation, Testing |
D. | Initialization,Testing, Incrementation |
Answer» D. Initialization,Testing, Incrementation | |