Computer Language Questions Practice Question and Answer
4 Q: Which of the following is not true for for-loop?
360 063e62af66149271af9b8c0fa
63e62af66149271af9b8c0fa- 1for (i=0; ifalse
- 2for (int i=0; i>9; i++)false
- 3for (i=10; ifalse
- 4for (i=10; i++; itrue
- Show AnswerHide Answer
- Workspace
- SingleChoice
Answer : 4. "for (i=10; i++; i"
Explanation :
Among the given statements about for loops, the one that is NOT true is that they are used to replace user input while loops. While for loops are typically used for iterations with a known count and are less likely to result in an infinite loop if used correctly, they do not specifically replace user input while loops.
Q: What is it called when more than one if-statement is used together?
357 063ede4ad7312b71d33e25815
63ede4ad7312b71d33e25815- 1if-else statementfalse
- 2nested statementtrue
- 3more if statementsfalse
- 4None of the abovefalse
- Show AnswerHide Answer
- Workspace
- SingleChoice
Answer : 2. "nested statement"
Explanation :
Certainly! A nested if statement refers to an if statement that is placed inside another if statement or other control structures. It allows for more specific conditions and complex decision-making in a program. The inner if statement is only executed if the outer if statement's condition is true.
Q: With which of the following is the Break statement used?
338 063ede5893c221e1b4dd104fd
63ede5893c221e1b4dd104fd- 1if Statementfalse
- 2else if Statementfalse
- 3Switch Statementtrue
- 4None of thesefalse
- Show AnswerHide Answer
- Workspace
- SingleChoice
Answer : 3. "Switch Statement"
Explanation :
The break statement is used with loops (such as for and while loops) and switch statements in programming. In loops, it is used to exit the loop prematurely, while in a switch statement, it is used to exit the switch block after executing a specific case.
Q: Why is clrscer() used?
279 063e62bb3e6cd351b75eca59e
63e62bb3e6cd351b75eca59e- 1to erasefalse
- 2to clear the message from the screentrue
- 3to storefalse
- 4for all of the abovefalse
- Show AnswerHide Answer
- Workspace
- SingleChoice
Answer : 2. "to clear the message from the screen"
Explanation :
The clrscr in C is a built-in function that is used for clearing the screen of the console output during the execution of the C program. This function is defined in the conio. h header file. We need to include the “conio.