You are on page 1of 12

Department of Computing Science

COMP 125 – Final Examination


April 18th, 2019 A.D.

NAME:____________________________________
FAMILY NAME GIVEN NAMES

UFV-ID #:_______ _________________________

INSTRUCTIONS
1. Calculators are not permitted.
2. This exam is closed book.
3. Clearly print your name and student ID number on this examination (above).
4. This exam contains multiple choice questions.

NOTES REGARDING MULTIPLE CHOICE QUESTIONS:


- There are five possible choices per question.
- There is one best choice for full credit (+1).
- The remaining four choices are worthless.
- CIRCLE THE LETTER CORRESPONDING TO YOUR CHOICE.

5. The values of all non-multiple choice questions are stated explicitly in bold.
6. There are 50 points in total
7. There are 12 pages including this cover sheet.
Page 2 of 12

1. The equation, y = 1/x,


a) is effectively computable for all x,
b) is an example of an equation that cannot be coded due to the singularity at x = 0,
c) can be coded solely with the sequential control structure of Dijkstra,
d) none of these choices,
e) both a) and c).
2. Which of the following is a universal logic gate (any circuit can be constructed with element
alone)?
a) AND,
b) NAND,
c) OR,
d) XOR,
e) none of these choices.
3. Consider the following C code:

Of the following, which best describes the growth of f(x) as a function of x?


a) logarithmic,
b) linear
c) quadratic,
d) cubic,
e) exponential.
4. What is wrong with the following BASIC code snippet:

10 PRINT "Hello, world"


20 GOTO 10

a) poor coding etiquette,


b) never halts,
c) syntax error,
d) the first two choices,
e) the first three choices.

2
Page 3 of 12

5. The time complexity of matrix multiplication, defined below, is given as bigO…

a) n,
b) n2,
c) n3,
d) en,
e) none of these choices.
6. Binary search
a) has logarithmic time complexity,
b) has a best-case time complexity,
c) is intractable,
d) was classified as a search algorithm,
e) none of these choices.
7. The Halting Problem
a) is intractable,
b) is associated with the Church-Turing Thesis,
c) is associated with Gödel’s Incompleteness Theorems,
d) the first and third choices,
e) none of these choices.
8. Von Neumann Architecture includes
a) sequential execution of instructions,
b) the instruction cycle,
c) solid-state secondary storage,
d) an interpreter,
e) none of these choices.
9. The output of a logic gate is ‘1’ when all its input are at logic 0. The gate is either
a) NAND or an EX OR gate,
b) NOR or an EX-NOR gate,
c) an OR or an EX NOR gate,
d) an AND or an EX-OR gate,
e) none of these choices.
10. A bulb in a staircase has two switches, one switch being at the ground floor and the other
one at the first floor. The bulb can be turned ON and also can be turned OFF by and one of
the switches irrespective of the state of the other switch. The logic of switching of the bulb
resembles.
a) an OR gate,
b) an AND gate,
c) an XOR gate,
d) a NAND gate,
e) none of these choices.

3
Page 4 of 12

11. The following figure represents a _____________ gate:

a) XOR,
b) NOR,
c) X-NOR,
d) NAND,
e) none of these choices.
12. The sentence, “Colorless green ideas sleep furiously” is
a) grammatically and syntactically correct,
b) only syntactically correct,
c) only semantically correct,
d) neither syntactically or semantically correct,
e) none of these choices.
13. A bit string of at least length ___ is required to represent an alphabet of 2000 unique
Chinese characters in an ASCII-like encoding scheme:
a) 8,
b) 9,
c) 10,
d) 11,
e) none of these choices.
14. A Turing Machine:
a) is a mechanical equivalent to the high-speed electronic digital computer,
b) is at the core of what it means to compute,
c) is only about human computational skills, independent of artificial computation,
d) showed that there are no limits to computation,
e) none of these choices.
15. The difference between while-loops and for-loops:
a) is not worth mentioning since they produce the same result,
b) has to do with flexibility,
c) is historical in that for-loop constructs evolved from while-loop constructs,
d) has nothing to do with the bounding number of loop cycles,
e) none of these choices
16. What does the following finite state machine do?

a) It outputs “1” iff the input string ends with “111”,


b) It outputs “0” iff the input string ends with “101”,
c) It outputs “1” iff the input string ends with “000”,
d) It outputs “0” iff the input string ends with “001”,
e) none of these choices.

4
Page 5 of 12

17. What does the following finite state machine do?

a) It is a parity bit machine.


b) It is a parity bit converter.
c) It is a bit inverter.
d) It is an incrementer.
e) none of these choices.
18. Floating point numbers:
a) are a subset of the set of real numbers,
b) are a subset of the set of integers,
c) are represented perfectly in computers,
d) means there are a fixed number of digits before and after the decimal point,
e) none of these choices.
19. The next binary number after 1101101 is:
a) 1101100,
b) 1101110,
c) 1101001,
d) 1101102,
e) None of these choices.
20. Given that processor speed has doubled roughly every 2 years, how long ago were
commercial computers roughly one thousand times slower?
a) 2010,
b) 2005,
c) 2000,
d) 1995,
e) None of these choices.
21. Which sentence best describes a transistor:
a) It is an electro-mechanical device,
b) It is a purely solid-state device,
c) It always allows electrical current to pass through it,
d) It never allows electrical current to pass through it,
e) None of these choices.

5
Page 6 of 12

22. The following diagram

a) is the current method of software development,


b) is too simple and requires “feedback loops” (improvement iterations),
c) always fails at requirements and has long since been abandoned,
d) requires riders to employ parachutes if the jump from each step is too large,
e) None of these choices.
23. The following diagram depicts

a) a for-loop on the left and a while-loop on the right,


b) a while-loop on the left and a for-loop on the right.
c) an if-then-else structure on the left and an if-then structure on the right,
d) an if-then structure on the left and an if-then-else structure on the right,
e) None of these choices.

6
Page 7 of 12

24. What is the cyclomatic complexity of the following code snippet?

a) 1,
b) 2,
c) 3,
d) 4,
e) None of these choices.
25. Which is not an axiom of Boolean Algebra:
a) Commutative Law,
b) Positive Law,
c) Distributive Law,
d) Associative Law,
e) None of these choices.
26. The symbol, +, in Boolean Algebra is associated with the logical connective:
a) AND,
b) Inclusive OR,
c) Exclusive OR,
d) Negation,
e) None of these choices.
27. Which logic gates are known as “universal gates”?
a) NAND,
b) NOR,
c) XOR,
d) The first two choices,
e) None of these choices.

7
Page 8 of 12

28. The following truth table is associated with:

a)

b)

c)

d) The first two choices.


e) None of these choices.
29. What kind of circuit is this?

a) Multiplexer,
b) Binary Adder,
c) Counter,
d) Decoder,
e) None of these choices.
30. The UNICODE system uses ____ bits to represent each character.
a) 4,
b) 8,
c) 16,
d) 32,
e) None of these choices.
31. Transistors are constructed from ____, such as silicon and gallium arsenide.
a) metals,
b) rare earth elements,
c) conductors,
d) The first two choices,
e) None of these choices.

8
Page 9 of 12

32. ____ circuits contain feedback loops in which the output of a gate is fed back as input to an
earlier gate.
a) Combinational,
b) Sequential,
c) Logic,
d) The first two choices,
e) None of these choices.
33. The following two circuits are ___________.

a) combinational,
b) equivalent,
c) sequential,
d) The first two choices,
e) None of these choices.
34. What Boolean expression is derived from the Sum-of-Products Algorithm for the following
truth table?

.
a) (A  B) + (A  B),
b) (A  B’) + (A’  B),
c) (A’  B) + (A’  B),
d) The first two choices,
e) None of these choices.

9
Page 10 of 12

35. What is the following logic circuit?

a) AND,
b) NAND,
c) NOR,
d) XOR,
e) None of these choices.
36. ____ circuits are used to determine the order in which operations are carried out inside a
computer and to select the correct data values to be processed.
a) Combinational,
b) Sequential,
c) Control,
d) The first two choices,
e) None of these choices.
37. The set of services and resources created by the system software and seen by the user is
called a(n) ____ machine.
a) Turing,
b) OS,
c) Virtual,
d) Finite State,
e) None of these choices.
38. A program written in assembly language is called the ____ code.
a) object,
b) source,
c) pseudo,
d) system,
e) None of these choices.
39. The number of bits required to represent the octal number, 313054158, in binary is
a) 8,
b) 16,
c) 24,
d) 32,
e) None of these choices.
40. The decimal equivalent of 0xBD is
a) 10111101,
b) 189,
c) 255,
d) 256,
e) None of these choices.

10
Page 11 of 12

41. Syntax relates to


a) grammar,
b) the amount of overhead encountered from the interpreter itself,
c) meaning,
d) tax on cigarettes and alcohol,
e) none of these choices.
42. A formal language is a:
a) set of strings and is not constrained by conflicting meanings assigned to them,
b) has well-ordered semantics,
c) is the opposite of a natural language,
d) is a synonym for pseudocode,
e) none of these choices.
43. Which is NOT an agreed upon control structure:
a) goto statement,
b) unconditional halt,
c) random execution of statements,
d) loop structure,
e) none of these choices.
44. An exception:
a) is a piece of code that produces a predictable result,
b) is an unusual path of a program that still produces the correct result,
c) produces exceptional results,
d) is an event that occurs during normal execution of code causing anomalies,
e) none of these choices.
45. Which of the following programs has the highest cyclomatic complexity?
a. One containing a thousand sequential statements and four for-loops,
b. One containing a thousand sequential statements and four if-else statements,
c. One containing one thousand sequential statements and four while-loops,
d. Choices a. and c.,
e. None of the above.
46. Which is NOT a trend in the Economics of Memory diagram described in the PPT on H/W?
a) faster as you move up the diagram,
b) slower as you move up the diagram,
c) less capacity as you move up the diagram,
d) more cost as you move up the diagram,
e) None of these choices.
47. A data structure
a) is visible to the user,
b) is not visible to the user,
c) allows for efficient handling of various data types,
d) Choices a) and c),
e) Choices b) and c).
48. A program variable in computing science
a) is essentially a memory location,
b) is associated with a symbolic name,
c) contains some known or unknown information,
d) Choices a) and b),
e) Choices a), b) and c).

11
Page 12 of 12

49. System software


a) includes the OS,
b) excludes utility programs which have to do with specific manufacturers of I/O devices,
c) includes the “virtual machine”,
d) Choices a) and c),
e) Choices a), b) and c).
50. The following code represents

a) a first generation language,


b) a 2GL,
c) source code,
d) Choices b) and c),
e) None of these choices.

12

You might also like