Computer Language Questions Practice Question and Answer

Q:

Which of the following is not true for for-loop?

360 0

  • 1
    for (i=0; i
    Correct
    Wrong
  • 2
    for (int i=0; i>9; i++)
    Correct
    Wrong
  • 3
    for (i=10; i
    Correct
    Wrong
  • 4
    for (i=10; i++; i
    Correct
    Wrong
  • Show AnswerHide Answer
  • Workspace

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 0

  • 1
    if-else statement
    Correct
    Wrong
  • 2
    nested statement
    Correct
    Wrong
  • 3
    more if statements
    Correct
    Wrong
  • 4
    None of the above
    Correct
    Wrong
  • Show AnswerHide Answer
  • Workspace

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 0

  • 1
    if Statement
    Correct
    Wrong
  • 2
    else if Statement
    Correct
    Wrong
  • 3
    Switch Statement
    Correct
    Wrong
  • 4
    None of these
    Correct
    Wrong
  • Show AnswerHide Answer
  • Workspace

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 0

  • 1
    to erase
    Correct
    Wrong
  • 2
    to clear the message from the screen
    Correct
    Wrong
  • 3
    to store
    Correct
    Wrong
  • 4
    for all of the above
    Correct
    Wrong
  • Show AnswerHide Answer
  • Workspace

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.

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully