Computer Language Questions Practice Question and Answer

Q:

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

1063 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:

With which of the following is the Break statement used?

1031 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?

969 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.

Q:

Which statement is used for more than one True and False statement?

962 0

  • 1
    if else
    Correct
    Wrong
  • 2
    else if
    Correct
    Wrong
  • 3
    Nested
    Correct
    Wrong
  • 4
    (b) and (c) both
    Correct
    Wrong
  • Show AnswerHide Answer
  • Workspace

Answer : 4. "(b) and (c) both"

      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