COSC 1315 Exam 2 (Chapters 4,5 & 10)
Exam Questions and Answers
The ________ operator is a unary operator, as it works with only one operand. - Answer
-NOT
The ________ statement is commonly used in programming languages for case
structure. - Answer -switch
In languages such as Java, Python, C, and C++ the ________ operator determines
whether a variable is equal to another variable. - Answer -==
Which of the following is a logical operator? - Answer -All of the above ("OR", "NOT" &
"AND")
The computer uses the ________ codes to accomplish string comparison. - Answer -
ASCII
The ________ symbol is used to represent a selection structure in flowcharting. -
Answer -diamond
The ________ symbol indicates that some condition must be tested in a flowchart. -
Answer -diamond
True/False: A nested decision structure can achieve the same logic as a case structure.
- Answer -True
In an If-Then-Else statement, the Else clause marks the beginning of the statements to
be executed when the Boolean expression is ________. - Answer -false
A condition is a ________ expression. - Answer -boolean
When a program performs actions only under certain conditions, it is using a ________
structure. - Answer -decision
A case structure is a ________ alternative decision structure. - Answer -Multiple
True/False: The If-Then-Else statement can be used to simplify a complex nested
decision structure. - Answer -True
, What two logical operators perform short-circuit evaluation? - Answer -AND and OR
In many languages the case structure is called a ________ statement. - Answer -switch
Which operator is best to determine whether x contains a value in the range of 10
through 57? - Answer -AND
True/False: The If-Then-Else statement should be used to write a single alternative
decision structure. - Answer -False
True/False: The first line of the case structure starts with the word CASE followed by the
test expression. - Answer -False
If the expression is false, the ________ operator will return true. - Answer -NOT
True/False: Although the sequence structure is heavily used in programming, it cannot
handle every type of task. - Answer -True
The ________ decision structure provides only one alternative path of execution. -
Answer -single alternative
________ expressions are named in honor of mathematician George Boole. - Answer -
Boolean
The ________ operator could be used, in some situations, to simplify nested selection
structures. - Answer -AND
A(n) ________ expression evaluates as either true or false. - Answer -boolean
Consider the following statement:
A store is giving a discount of 30% for all purchases of over $100.
Which of the following is not the appropriate structure to use to program the statement?
- Answer -Sequence
Which of the following operators reverses the logic of its operand? - Answer -NOT
The value of the ________ is compared with the values that follow each of the Case
statements when a Select Case statement executes. - Answer -test expression
In a(n) ________ decision structure, one path is taken if a condition is true and the other
path is taken if the condition is false. - Answer -dual alternative
Some languages, such as Visual Basic, use ________ as the not equal to operator. -
Answer -<>
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller millyphilip. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $11.99. You're not tied to anything after your purchase.