Structures & Algorithms s
Exam Questions with Answers
What is a pseudocode?
Simple programming language.
A text editor.
A way of writing programming code in English.
A structured method which can be compiled. - Correct Answers: A way of writing programming code in
English.
One of the important considerations when writing pseudocode is to _____.
specify a programming language
write everything in a paragraph
write only one statement per line
write only a portion of the program that is important - Correct Answers: write only one statement per
line
Which of the following pseudocodes is appropriate to compute area of a triangle?
- Enter base length, B
| Enter height, H
| Compute the area = 1/2 * B * H
- Display area
- Enter the base length B and height H and compute area
- Display area
- Enter base length, B
- Compute the area=2*B*H
- Compute the area using the formula 1/2 * Base * Height
- Display the area - Correct Answers: - Enter base length, B
,| Enter height, H
| Compute the area = 1/2 * B * H
- Display area
Which statement is NOT an advantage of pseudocode?
It is written easily in a word processing application.
It is standardized.
It is easy to modify.
It can be used with structured programming languages. - Correct Answers: It is standardized.
Which of the following is TRUE about pseudocode?
It cannot be modified.
It cannot be compiled.
It can be compiled in any language you use.
It is harder to write than making flowcharts. - Correct Answers: It cannot be compiled.
Gwen is an IT programmer for a small, non profit company. She's been assigned to write some new code
for her company's payroll department to assist with the roll-out of a new pay for performance system.
The new code will affect employees' pay grades, salaries, and bonuses. Gwen has written pseudo-code
and the actual code. What should be her next step in the process?
Test and debug the code
Release the code to the production environment
Test the code with real-world users
Train end users on the changes to the payroll program - Correct Answers: Test and debug the code
A code editor that is used to check syntax, format, run, and test code is known as a/an _____.
integrated development environment
test environment
artificial intelligence system
integrated developer extension - Correct Answers: integrated development environment
,How does the IDE component, known as syntax highlighting, aid developers with writing program code?
The tool highlights misspelled words.
The tool automatically corrects common typos while typing.
The tool makes it easier to recognize the various elements of code .
The tool automatically corrects text formatting while typing. - Correct Answers: The tool makes it easier
to recognize the various elements of code
Explanation
Syntax highlighting includes displaying code using different colors to indicate the different types of
elements in code.
Which of the following is NOT a typical component of an Integrated Development Environment?
Debugger
Grammar checking
Autocompletion
Syntax checking - Correct Answers: Grammar checking
How does using a debugger in an integrated development environment benefit an individual who is
writing code?
It is best not to use a debugger, but instead to be thorough and read through all of the lines of code to
find the bugs.
A debugger can assist with generating test case scenarios which can then be used to test the code to
find the bugs.
A debugger can automatically fix the broken code for the individual once the bugs have been identified.
A debugger walks through code in a systemic and automatic manner to find bugs, making the process
less time consuming. - Correct Answers: A debugger walks through code in a systemic and automatic
manner to find bugs, making the process less time consuming.
A while loop is considered _____ if you don't know when the condition will be true
Indefinite
Passive
, Infinite
Positive - Correct Answers: Indefinite
What will be the result of the following code?
int j = 0;
while (j < 1000) {
j = j - 1;
} - Correct Answers: Endless loop
A while loop runs code as long as the condition(s) is/are:
False
Positive
True
Negative - Correct Answers: True
A while loop can evaluate _____ condition(s).
Only one
Exactly two
Zero
One or more - Correct Answers: One or more
Which is the correct syntax for a while loop?
while 1=0 {
minute++;
}
while (total_panic < 1) {
minute++;
}