Midterm Coding quiz
What is the largest value that can be stored in one byte?
255
Which operator is best to determine whether x contains a value in the range of 10 through 57?
AND
What two logical operators perform short-circuit evaluation?
AND and OR
Which of the following is a logical operator?
All of the above
Programs that make a computer useful for everyday tasks are known as ________.
Application Software
Which computer language uses short words known as mnemonics for writing programs?
Assembly
Which of the following devices is a computer?
BlackBerries® Car navigation systems Cell phones iPods®
The statements that appear between the While and the End While clauses are called the ________________.
Body of the loop
Which structure is a logical design that controls the order in which a set of statements executes?
Control
The following is an example of an instruction written in which computer language?10110000
Correct! Machine language
To ___________ a variable means to decrease its value.
Decrement
True/False: A named constant can be assigned a value using a Set statement.
False
True/False: An uninitialized variable is a variable that has been declared and automatically initialized to zero.
False
True/False: In the For statement, you can only use positive integers as step values.
False
True/False: It is possible to write a complete program using only a decision structure.
False
True/False: Programmers start writing code as the first step when they begin a new project.
False
True/False: Pseudocode could be logically incorrect if not properly indented
False
True/False: The While loop will never execute if its condition is true to start with.
False
The process known as the ________ cycle is used by the CPU to execute instructions in a program.
Fetch-decode-execute
The program development cycle is made up of ______ steps that are repeated until no errors can be found in the program.
Five
The intended purpose of the following codes is to set the temp to the value 32.0 if it is not already equal to 32.0. Where is the error? Select the correct code to replace the incorrect code. If NOT temp == 32.0 Then Set temp = 32.0 End If
If NOT (temp == 32.0) Then
Part of the following pseudocode is incompatible with the Java, Python, C, and C++ languages. Select the correct piece of code you would use to replace the incorrect code. Declare Integer num1, num2;set num1= 10;set num2 = 15; If num1 = num2 Then Display "The values are equal." Else Display "The values are NOT equal." End If
If num1 == num 2 Then
The intended purpose of the following codes is to determine whether the value is outside of a specified range. Select the correct line of code to replace the incorrect code. If value < lower AND value > upper Then Display "The value is outside the range." Else Display "The value is within range." End If
If value < lower OR value > upper Then
How many times will the following loop iterate? Set k = 1 While k < = 5 Display k End While
Infinite
Which of the following is not an example of operating system software?
Microsoft Word
Which of the following operators reverses the logic of its operand?
NOT
Which operator is used to determine that the operands are not exactly of the same value?
None of the above
Which operator would make the following expression true?True _______ False
OR
A computer system consists of all of the following, except ________.
Operating System
Which symbol is used for an assignment statement in a flowchart?
Processing
What type of operator can be used to determine whether a specific relationship exists between two values?
Relational
A loop that accumulates a total as it reads each number from a series is often said to keep a what?
Running Total
The ___________ represents a special value that marks the end of a list of values.
Sentinel
A _________ structure is a set of statements that execute in the order they appear.
Sequence
The amount by which the counter variable is incremented in a For loop is known as what?
Step amount
The term used for a set of rules that must be strictly followed when writing a program is ________.
Syntax
Find the error in the following pseudocode: Declare Boolean finished = False Declare Integer value, cube While finished != True Display "Enter a value to be cubed." Input value; Set cube = value^3 Display value, " cubed is ". cube End While
The Boolean variable has no way of being modified in the loop.
The programmer intended the following pseudocode to get five sets of two numbers each, calculate the sum of each set, and calculate the sum of all the numbers entered. It will not function as intended, however. Find the error. //This program calculates the sum of five sets of two numbers. Declare Integer number, sum, total Declare Integer sets, numbers Constant Integer MAX_Sets = 5 Constant Integer Max_Numbers = 2 Set sum = 0 Set total = 0 For sets = 1 to MAX_NUMBERS For numbers = 1 to MAX_SETS Display "Enter number ", numbers, " of set ", sets, "." Input number Set sum = sum + number End For Display "The sum of set ", sets, " is ", sum, "." Set total = total + sum Set sum = 0 End for Display "The total of all the sets is ", total, "."
The ranges of the inner loop and outer loop are mismatched.
What function(s) does an interpreter perform with the instructions in a high-level programming language?
Translates and Execute
True/False: A condition-controlled loop can be used to iterate the body of the loop a specific number of times.
True
True/False: A nested decision structure can be used to test more than one condition.
True
True/False: A variable is a storage location in memory that is represented by a name and can hold different values during the execution of the program.
True
True/False: In a For loop, the programmer should know the exact number of iterations the loop must perform before writing the code.
True
True/False: Modules can be called from statements in the body of any loop.
True
True/False: Most programming languages do not automatically print spaces between multiple items that are displayed on the screen.
True
True/False: Programmers use pseudocode to create 'mock-ups' of programs because they do not have to worry about syntax rules.
True
True/False: The If-Then-Else statement can be used to simplify a complex nested decision structure.
True
True/False: The While loop is known as a pretest loop, which means it tests its condition before performing an iteration.
True
What is the encoding technique called that is used to store negative numbers in the computer's memory?
Twos complement
The programmer intended the following pseudocode to display the numbers 1 through 60, and display the message "Time's up!" Will it function correctly? If not, which line of code should be replaced? Declare Integer counter = 1 Constant Integer TIME_LIMIT = 60 While counter < TIME_LIMIT Display counter Set counter = counter + 1 End While Display "Time's up!"
While counter <= TIME_LIMIT
Which mathematical operator is used to raise five to the second power?
^
The smallest storage location in a computer's memory is known as a ________.
bit
What term can be used to describe anything that uses binary numbers?
digital
The disk drive is a secondary storage device that stores data by ________ encoding it onto circular disks.
magnetically
Data is not recorded magnetically on a(n) ________, but is encoded as a series of pits on the disk surface.
optical disk