In: Computer Science
Part1:
1.An algorithm is .
a) a series of actions that solve a particular problem.
b) an english description of a problem to be solved.
c) the process of converting between data types.
d) None of the above.
2. Program control is best defined as .
a) the degree of control a program has over the computer on which it is executed.
b) the line of code that is executing at a given time.
c) the order in which a series of statements is executed.
d) None of the above.
3. Pseudocode is a(n) .
a) hybrid language of all object-oriented languages.
b) artificial language used to develop algorithms.
c) language used to translate from Python to assembly language.
d) None of the above.
4.Pseudocode is most comparable to .
a) C#.
b) C.
c) Pascal.
d) English.
5.Which of the following is a type of control structure?
a) declaration structure.
b) repetition structure.
c) flow structure.
d) All of the above.
6.A transfer of control occurs when a .
a) program changes from input to output, or vice versa
b) logic error occurs in a program
c) statement other than the next one in the program executes
d) None of the above
7.
The three types of selection structures are , and :
a) for , if , if /else .
b) for , while , if .
c) if , if /else , while .
d) if , if /else , if /elif /else .
8.
What capability does if /else provide that if does not?
a) the ability to execute actions when the condition is false.
b) the ability to nest structures.
c) the ability to stack structures.
d) None of the above.
9.
Python prints a(n) when a fatal logic error occurs.
a) logic message.
b) traceback.
c) exception.
d) None of the above.
10.
Which of the following results in a fatal logic error?
a) attempting to add numbers that have not been converted from string format.
b) dividing by zero.
c) forgetting a colon in an if structure.
d) All of the above.
11. Which of the following statements would cause a while structure to stop
executing?
a) 3 <= 11 .
b) !(7 != 14) .
c) 6 != 9 .
d) All of the above.
12.
In a(n) , the body of a while structure never stops executing.
a) syntax error.
b) fatal error.
c) infinite loop.
d) None of the above.
13. A can be used in a repetition structure to control the number of times a
set of statements will execute.
a) declaration.
b) counter.
c) controller.
d) None of the above.
14.
A can be used in repetition structures to indicate the end of data entry.
a) counter.
b) boolean.
c) sentinel value.
d) None of the above.
15. The expression a *= 4 is correctly represented by:
a) a = 4 * 4 .
b) a = 4a .
c) a = a * 4 .
d) None of the above.
16. Counting loops should be controlled with values.
a) floating-point.
b) integer.
c) string.
d) None of the above.
17. The function call produces the same sequence as range( 10 ) .
a) range( 1, 10 ) .
b) range( 10, 1 ) .
c) range( 0, 10, 1 ) .
d) None of the above.
18. The characters %21.2f indicate a floating-point value will be printed with
how many positions to the left of the decimal point?
a) 21.
b) 18.
c) 2.
d) 19.
19.
The statement, when executed in a while loop, skips the remaining
statements in the body of the structure and begins the next iteration of the loop.
a) continue .
b) break .
c) next .
d) None of the above.
20.
The logical and operator ensures that .
a) two conditions are true.
b) at least one condition is true.
c) two conditions are false.
d) None of the above.
21.
Python provides the operator to reverse the meaning of a condition.
a) opposite .
b) not .
c) reverse .
d) All of the above.
Part2:
1.The small, simple pieces that are used to construct programs are typically
referred to as .
a) components.
b) segments.
c) sections.
d) None of the above.
2. A function is invoked by a .
a) function call.
b) function header.
c) declaration.
d) None of the above.
3.
Variables declared in function definitions are variables.
a) global.
b) local.
c) constant.
d) None of the above.
4.
Functions are called by writing the name of the function followed by zero or
more enclosed in parentheses.
a) conditions.
b) arguments.
c) counters.
d) None of the above.
5.
Which of the following correctly calls the math module function sqrt with
a value of 36?
a) math(sqrt, 36) .
b) math.sqrt(36) .
c) math.sqrt = 36 .
d) None of the above.
6.
Which of the following is a correct function definition header?
a) def count (x,y) .
b) def count (x,y): .
c) count (x,y): .
d) None of the above.
7. _____is a Python value that represents null.
a) None .
b) Null .
c) Nothing .
d) None of the above.
8. The capability of random-number generation is provided in the module .
a) rng .
b) random .
c) rand .
d) None of the above.
9. A recursive function is a function that .
a) calls another function.
b) calls itself.
c) does not return a value.
d) None of the above.
10. Iteration uses a structure, whereas recursion uses a structure.
a) repetition, selection.
b) sequence, repetition.
c) selection, repetition.
d) selection, sequence.
11. A difference between recursion and iteration is that:
a) iteration involves an explicit repetition structure unlike recursion.
b) recursion is associated with a counter controlled repetition.
c) iteration cannot execute infinitely, like recursion.
d) None of the above.
1)
The answer is option a.
An algorithm is sequence of instructions that solve a particular problem.
2)
The answer is option c.
The program control is the order in which the series of statements are executed.
It is basically about how a program makes decisions and executes the statements.
3)
The answer is option d.
A Pseudocode is a general english language description of the steps in an algorithm.
This is mainly used and developed for the purpose of human reading.
4)
The answer is option d.
A Pseudocode is a general english language description of the steps in an algorithm.
This is mainly used and developed for the purpose of human reading.
Note:
Please see that as per the guidelines, we are allowed to answer maximum upto one question posted in a single question.
In case of multiple choice type questions, upto 4 questions can be answered.
Please post the remaining questions as another question for further help and assistance. Thank you.