Control Structures- Quiz 1

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Wecskhoji
W
Wecskhoji
Community Contributor
Quizzes Created: 1 | Total Attempts: 524
| Attempts: 524 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. Answer the output of the following program.

Explanation

The given answer "300 200" is the output of the program. The program takes a series of inputs, each consisting of two numbers. It then compares the two numbers and prints the smaller number followed by a space and then the larger number. In this case, the program compares 500 and 300 and prints "300 500". Next, it compares 300 and 200 and prints "200 300". Then, it encounters the input "Garbage 200" which is not a valid input and is ignored. Finally, it compares 300 and 300 and prints "300 300". Therefore, the final output is "300 200".

Submit
Please wait...
About This Quiz
Control Structures- Quiz 1 - Quiz

Control Structures- Quiz 1 assesses understanding of program outputs involving basic control structures. It tests skills in reading and predicting code behavior, essential for learners in computer science.

2. Answer the output of the following program.

Explanation

The given output suggests that there are two errors in the program, specifically on lines 4 and 5. The program seems to be printing out a phrase "RATTA MAAR LEARN REAL ENGINEERING" but encounters errors on lines 4 and 5. The correct answer, "LEARN REAL ENGINEERING," implies that the program is able to print this phrase successfully before encountering the errors. However, without the actual program or further context, it is not possible to determine the exact nature of the errors or what the program is intended to do.

Submit
3. Answer the output of the following program.

Explanation

The correct answer is "x and y are equal." This is because the program does not provide any comparison or condition to check the equality of x and y. Therefore, it assumes that x and y are equal by default.

Submit
4. Answer the output of the following program.

Explanation

The program first prints "10 20" because the numbers 10 and 20 are given as input. Then it encounters an error because there is a syntax mistake in the code. The error is caused by the semicolon after the "if" statement, which is not allowed. Finally, the program prints "20 10" because it encounters a print statement after the error, and the numbers 20 and 10 are given as input.

Submit
5. Answer the output of the following program.

Explanation

The output of the program will be "Garbage 200". This is because the program is reading four lines of input, and the first three lines are ignored as they do not match the expected format of two integers. The fourth line matches the format, with the first value being "Garbage" and the second value being "200". Therefore, the program will output "Garbage 200".

Submit
6. Answer the output of the following program.

Explanation

The given program is likely checking for a condition using an "else" statement. However, it is incorrect to end an "else" statement with a semi-colon. This results in a syntax error. The program then prints the numbers 3 and 5 on separate lines. Finally, it prints the number 3 on a new line.

Submit
7. Answer the output of the following program.

Explanation

The output of the program is "NO ERROR". This means that there are no errors in the program and it will run without any issues.

Submit
8. Answer the output of the following program.

Explanation

The program assigns the values 3, 10, and 0 to variables x, y, and z respectively. Then, it assigns the values 10, 10, and 10 to variables x, y, and z respectively. After that, it assigns the values 3, 10, and 3 to variables x, y, and z respectively. Finally, it assigns the values 10, 10, and 0 to variables x, y, and z respectively. Therefore, the final values of x, y, and z are 10, 10, and 0 respectively.

Submit
9. Answer the output of the following program.

Explanation

The given program assigns the values 15, 15, and 15 to variables a, b, and c respectively. Then, it assigns the values 5, 15, and 5 to the same variables. Finally, it assigns the values 15, 5, and 0 to the variables. Therefore, the output of the program would be a=15, b=15, and c=0.

Submit
10. Answer the output of the following program.

Explanation

The given program appears to be printing a series of numbers. The numbers are separated by spaces. The output shows three sets of numbers: 0 50 0, which are printed in the same order as they appear in the program. Therefore, the correct answer is 0 50 0.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 21, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 04, 2020
    Quiz Created by
    Wecskhoji
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Answer the output of the following program.
Answer the output of the following program.
Answer the output of the following program.
Answer the output of the following program.
Answer the output of the following program.
Answer the output of the following program.
Answer the output of the following program.
Answer the output of the following program.
Answer the output of the following program.
Answer the output of the following program.
Alert!

Advertisement