Concept explainers
A ______ structure can execute a set of statements only under certain circumstances.
a. sequence
b. circumstantial
c. decision
d. Boolean
The structure which executes under certain conditions is decision structure.
Hence, the correct answer is option “C”.
Explanation of Solution
Decision structure:
Decision structure executes a set of statements under certain conditions. It is also known as selection structure. The action is performed only when the condition exists and takes different action depending upon the state “True” or “False”.
Example for decision structure:
“if” statement:
“if” statement is used to make a decision structure, which permits the program to hold more than one path of execution.
- The indented statement is executed only when the condition is “true”.
- If the given condition is “false”, it skips the indented statements.
Syntax for “if” statement:
if condition:
indented_statement_block
Explanation for incorrect options:
Simplest form of control structure is the “sequence structure”. It is a group of statements that are executed in an order in which they appear.
Hence, option “A” is wrong.
Circumstantial structure does not execute the statements under certain conditions.
Hence, option “B” is wrong.
The Boolean expression evaluates the statement as either “True” or “False” with the help of “if” statement.
Hence, option “D” is wrong.
Want to see more full solutions like this?
Chapter 3 Solutions
Starting Out with Python (4th Edition)
Additional Engineering Textbook Solutions
Database Concepts (7th Edition)
Starting Out with C++: Early Objects
Java: An Introduction to Problem Solving and Programming (7th Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
- True or False 6. In languages that require variable declarations, a variable’s declaration must appear before any other statements that use the variable.arrow_forwardJava VENDING MACHINE Write a program that simulates a vending machine. The program should display a menu of items, along with the price and quantity of each item. The user can select an item and insert money to purchase the item. The program should display the item purchased, the cost of the item, and the amount of change returned to the user. REQUIREMENTS DECISION STRUCTURES Include at least (1) EACH of the following: ·If-Else-Else If Statements ·Switch Statement LOOPS Include at least (2) DIFFERENT TYPES of loops from the following: ·FOR loop ·WHILE loop ·DO-WHILE loop FILE MANAGEMENT Your project should perform at least (1) of the following tasks: ·READ FROM an input file ·WRITE TO an output file ·READ FROM and WRITE TO the same file METHODS Include at least (10) Methods throughout your Project. Include at least (1) Overloaded Programmer-Defined Method in your Project. JAVA CLASSES Include at least (3) Classes in your Project Include at least (1) Class that inherits…arrow_forwardT F Variable names may begin with a number.arrow_forward
- A structure can execute a set of statements only under certain circumstances.a. sequenceb. circumstantialc. decisiond. Booleanarrow_forwardi uploaded the screenshot please help me to do pseudocode And do flowchart should be in c++arrow_forwardC++ Language Write a single cout statement that prints exactly the following on the screen while there are no leading or trailing spaces "I am doing PF Exam and '\t' means four spaces".arrow_forward
- C# Question Write a statement that declares a variable words and initialize it to the following list of words: “one”, “two", “three”arrow_forwardCurly braces {} around the code after an if statement are only allowed if there is more than one line of code inside the braces. True False Varrow_forward____ are combined by multiplicative operators (* and /). A. Terms B. Tokenizers C. Expressions D. Factorsarrow_forward
- In C++, the symbol ==, which consists of two equal signs, is called the ____ operator.arrow_forwardC++ Visual 2019 Last month Joe purchased some stock in Acme Software, Inc. Here are the details of the purchase: The number of shares that Joe purchased was 1,000. When Joe purchased the stock, he paid $45.50 per share. Joe paid his stockbroker a commission that amounted to 2 percent of the amount he paid for the stock. Two weeks later, Joe sold the stock. Here are the details of the sale: The number of shres that Joe sold was 1,000. He sold the stock for $56.90 per share. He paid the stockbroker another commission that amounted to 2 percent of the amount he received for the stock. Write a program that displays the following information: The amount of money Joe paid for the stock. The amount of commission Joe paid his broker when he bought the stock. The amount that Joe sold the stock for. The amount of commission Joe paid his broker when he sold the stock. Display the amount of profit that Joe made after selling his stock and paying the two commissions to his broker. (If the…arrow_forwardA _______ error is when a program the programmer type a * instead of a + in a formula or calculation. The program will run but the output will be incorrect A logic B Expression C Syntax D runtimearrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning