Problem Solving With Decisions And Looping Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Itcs.msu
I
Itcs.msu
Community Contributor
Quizzes Created: 1 | Total Attempts: 496
Questions: 20 | Attempts: 498

Settings

How good are you at problem-solving using loops? Try this problem-solving quiz, and see if you know everything or if you need to learn more. Looping is a kind of decision-making where it is evaluated whether a particular condition has occurred or not. Do you know what is the right syntax used for the while loop? How many types of conditions are used during the problem-solving process? Start the quiz to find answers to similar questions. All the best!

• 1.

A programmer will use __________ to decide whether the set of instructions is to be executed based on the condition whether it is TRUE or FALSE.

• A.

Sequence logic structure

• B.

Decision logic structure

• C.

Looping logic structure

• D.

Case logic structure

B. Decision logic structure
Explanation
A programmer will use the decision logic structure to decide whether the set of instructions is to be executed based on the condition whether it is TRUE or FALSE. This structure allows the programmer to control the flow of the program by evaluating a condition and executing different blocks of code based on the result. It is commonly used in programming languages to implement if-else statements and switch statements, which help in making decisions and performing different actions based on the conditions provided.

Rate this question:

• 2.

How many types of conditions are there in problem-solving?

• A.

1

• B.

2

• C.

3

• D.

4

B. 2
Explanation
There are two types of conditions in problem-solving.

Rate this question:

• 3.

Multiple conditions have ______ kinds of logic.

• A.

1

• B.

2

• C.

3

• D.

4

C. 3
Explanation
Multiple conditions have three kinds of logic.

Rate this question:

• 4.

A single condition has __________ or __________.

• A.

Actions

• B.

Codes

• C.

Set of instructions

• D.

Cases

A. Actions
C. Set of instructions
Explanation
A single condition can have a set of actions or a set of instructions associated with it. This means that when the condition is met, either a series of actions or a set of instructions will be executed. The actions or instructions can vary depending on the specific condition and the desired outcome.

Rate this question:

• 5.

A programmer uses positive logic when he is telling the computer to follow a set of instructions and continue processing if the condition is True; If the condition is not True, then the computer processes another decision.

• A.

True

• B.

False

A. True
Explanation
Positive logic is a programming approach where the computer follows a set of instructions and continues processing if a given condition is true. If the condition is not true, the computer proceeds with another decision. Therefore, the given statement accurately describes positive logic, making the answer "True" correct.

Rate this question:

• 6.

The following are the kinds of multiple conditions, EXCEPT __________.

• A.

Straight-through logic

• B.

Positive logic

• C.

Negative logic

• D.

Question logic

D. Question logic
Explanation
The given answer suggests that "question logic" is not a kind of multiple condition. This implies that "question logic" does not fall under the category of different types of conditions such as straight-through logic, positive logic, and negative logic. However, without further context or information, it is difficult to provide a more detailed explanation.

Rate this question:

• 7.

Decision logic structure use IF/Then/Else.

• A.

True

• B.

False

A. True
Explanation
Decision logic structures use IF/Then/Else statements to determine the flow of a program based on certain conditions. These structures allow the program to make decisions and execute different sets of instructions depending on whether a condition is true or false. By using IF statements, the program can evaluate a condition and then execute a specific set of instructions if the condition is true. If the condition is false, the program can also execute a different set of instructions using the Else statement. Therefore, the statement "Decision logic structures use IF/Then/Else" is true.

Rate this question:

• 8.

A programmer will use __________ to tell the computer to process another decision when the resultant of the condition is True; If the resultant is False, then the computer processes a consequent set of instructions and continues processing the module.

• A.

Straight-through logic

• B.

Positive logic

• C.

Negative logic

• D.

Question logic

C. Negative logic
Explanation
A programmer will use negative logic to tell the computer to process another decision when the resultant of the condition is False. If the resultant is True, then the computer processes a consequent set of instructions and continues processing the module. Negative logic involves using a logical NOT operator to invert the condition, so that when the condition is False, it becomes True and vice versa. This allows the programmer to control the flow of the program based on the opposite of the condition's outcome.

Rate this question:

• 9.

A programmer will use __________ when all decisions have to be processed and when they are independent of each other.

• A.

Straight-through logic

• B.

Positive logic

• C.

Negative logic

• D.

Question logic

A. Straight-through logic
Explanation
A programmer will use straight-through logic when all decisions have to be processed and when they are independent of each other. This means that the program will simply execute each decision in a linear manner, without any branching or conditional statements. This approach is suitable when all decisions need to be processed regardless of their outcomes, and when the decisions do not affect each other's execution.

Rate this question:

• 10.

Which flowchart symbol is used for decision or condition?

• A.

Option 1

• B.

Option 2

• C.

Option 3

• D.

Option 4

A. Option 1
Explanation
The flowchart symbol used for decision or condition is represented by Option 1. This symbol typically takes the form of a diamond shape with two branches, one for the "yes" condition and one for the "no" condition. It is used to represent a point in the flowchart where a decision needs to be made based on a certain condition or criteria.

Rate this question:

• 11.

A programmer will use __________ to execute the lines of code repeatedly.

• A.

Sequence logic structure

• B.

Decision logic structure

• C.

Looping logic structure

• D.

Case logic structure

C. Looping logic structure
Explanation
A programmer will use looping logic structure to execute the lines of code repeatedly. Looping allows the programmer to repeat a specific set of instructions multiple times until a certain condition is met. This is useful when there is a need to perform a task iteratively or when a certain code block needs to be executed a fixed number of times. By using looping logic structure, the programmer can save time and effort by automating repetitive tasks and making the code more efficient.

Rate this question:

• 12.

The following are the kinds of loops, EXCEPT __________.

• A.

For

• B.

IF/Then/ Else

• C.

While

• D.

Do-while

B. IF/Then/ Else
Explanation
The given options list different types of loops, including "for," "while," and "do-while." However, "IF/Then/Else" is not a type of loop but a conditional statement used for decision-making in programming. It is used to execute a block of code if a certain condition is true, otherwise, it executes a different block of code. Therefore, the correct answer is "IF/Then/Else" as it is not a kind of loop.

Rate this question:

• 13.

The programmer will use do-while to repeat the lines of code at least one-time execution.

• A.

True

• B.

False

A. True
Explanation
A do-while loop is a type of loop in programming that executes a block of code at least once, regardless of the condition being true or false. This is because the condition is checked at the end of the loop. Therefore, the statement that the programmer will use a do-while loop to repeat the lines of code at least one-time execution is true.

Rate this question:

• 14.

__________ occurs when a module or a function calls itself.

• A.

Increment

• B.

Accumulation

• C.

Recursion

• D.

Indicator

C. Recursion
Explanation
Recursion occurs when a module or a function calls itself. It is a programming technique that allows a problem to be solved by breaking it down into smaller subproblems of the same type. This can lead to elegant and concise code, as well as efficient problem-solving. Recursion is commonly used in algorithms such as tree traversal, searching, and sorting. By calling itself, a function can repeatedly solve smaller versions of the problem until a base case is reached, which terminates the recursion.

Rate this question:

• 15.

__________ are logical variables that a programmer sets within a program to change the processing path or to control when the processing of a loop should end.

• A.

Indicators

• B.

Recursions

• C.

Increments

• D.

Accumulations

A. Indicators
Explanation
Indicators are logical variables that a programmer sets within a program to change the processing path or to control when the processing of a loop should end. These variables act as flags and can be used to determine whether a certain condition has been met or not. By setting and checking the values of indicators, programmers can alter the flow of the program and make decisions based on the state of these variables. This allows for more flexible and dynamic control over the execution of the program.

Rate this question:

• 16.

I++ is similar to __________.

• A.

I = i - 1

• B.

I = i / 1

• C.

I = i + 1

• D.

I = i * 1

C. I = i + 1
Explanation
The correct answer is i = i + 1 because the "++" operator is known as the increment operator in programming. It increases the value of i by 1. Therefore, i++ is equivalent to i = i + 1.

Rate this question:

• 17.

Which is the right syntax for the while loop?

• A.

while pizza <= 5 cout << "text";

• B.

WHILE pizza <= 5 { cout << "text"; }

• C.

While (pizza <= 5) { cout << "text"; }

• D.

While pizza <= 5) { cout << "text"; }

C. While (pizza <= 5) { cout << "text"; }
Explanation
The correct syntax for a while loop is "while (condition) { code }". In this case, the condition is "pizza

Rate this question:

• 18.

Fill in the blanks to print x's values from 1 to 5. Increment x's value using the ++ operator. int x = 1; ________  (x <= 5) {   cout << x << endl;   x________; }

while
++
Explanation
The code uses a while loop to print the values of x from 1 to 5. The condition for the while loop is that x is less than or equal to 5. Inside the loop, the value of x is printed using cout, and then x is incremented using the ++ operator. This means that x will increase by 1 in each iteration of the loop.

Rate this question:

• 19.

Fill in the blanks to print x's values to the screen 10 times: ________ (int x = 1; x <= 10; ________ ++) {   cout << x << endl; }

for
x
Explanation
The correct answer is "for, x" because the question is asking for the missing elements in the code to print the value of x to the screen 10 times. The "for" loop is used to iterate over a block of code a specific number of times, and "x" is the variable that is being incremented each time the loop runs. This allows the code to print the value of x to the screen and continue looping until x reaches 10.

Rate this question:

• 20.

Fill in the blanks to check if the age variable is greater than 18: int age = 25; ________ (________> 18) {    cout << "Adult"; }

if
age
Explanation
The if statement is used to check a condition, in this case whether the age variable is greater than 18. The variable "age" is being checked to see if it is greater than 18, and if it is, the statement "Adult" will be printed.

Rate this question:

Related Topics