Quiz 1 review

1 All homework questions

Question 1

Which of the following are not stored in binary in the computer?

  1. Colors
  2. Everything is stored in binary in the computer
  3. Folders
  4. Letters
  5. Programming commands

Question 2

Before the things we call computers were invented, the word computer

  1. Didn’t exist in English
  2. Had roughly the same meaning it has today, but only existed in fiction
  3. Referred to a profession
  4. Referred to an abacus or other mechanical arithmetic aid

Question 3

Which of these is not an encoding for colors?

  1. CMYK
  2. RGB
  3. Y2K

Question 4

In ASCII, characters are 8 bits, but the first bit is always 0. How many characters can be represented in ASCII?

Question 5

Which of these is not a power of 2?

  1. 1
  2. 124
  3. 2
  4. 256
  5. 64
  6. 8

Question 6

Which is a larger number, 0x111 or 0b111? (By larger, I mean greater in magnitude)

  1. 0b111
  2. 0x111
  3. They’re the same number

Question 7

There are ___ bits in a byte

Question 8

How many symbols are used in the binary number system?

Question 9

0111 1010 0001 1110 0000 0010 is a

  1. Color
  2. Computer instruction
  3. Letter
  4. Number
  5. We can’t know without knowing the encoding ahead of time

Question 10

Which of these is not a likely problem with numbers in computers?

  1. If you add numbers that are too large, the number will overflow and the result will be incorrect.
  2. It takes longer for the computer to process binary numbers than hexadecimal numbers because they have more digits, which can cause unexpected delays.
  3. When you compare two numbers with decimal points (aka floats like 0.1), you may get an incorrect result due to roundoff error.

Question 11

Moore’s law says that “Microchips have their ___ every two years.“

  1. cost double
  2. cost halve
  3. number of transistors double
  4. number of transistors halve
  5. speed double
  6. speed halve

Question 12

The following truth table is for what operation?

A B result
0 0 0
0 1 1
1 0 1
1 1 1
  1. AND
  2. OR
  3. XOR
  4. binary addition
  5. mux/multiplex

Question 13

How many bytes are in a megabyte?

  1. Eight billion
  2. Eight million
  3. One million
  4. One thousand

Question 14

Which of these is biggest?

  1. Exabyte
  2. Petabyte
  3. Terabyte

Question 15

Which of these is smallest?

  1. Exabyte
  2. Petabyte
  3. Terabyte

Question 16

What is not a difference between memory (RAM) and storage (SSD/HDD)?

  1. memory costs less per byte than storage, and hence tends to be smaller in most computers
  2. memory is faster to access than storage
  3. memory is volatile (data disappears when power is turned off) while storage is nonvolatile (data remains after power is lost)
  4. memory is where the processor keeps most data it works with

Question 17

The ___ is made up of the ___ and the ___

  1. The ALU is made up of the CPU and the CU
  2. The ALU is made up of the CPU and the RAM
  3. The ALU is made up of the CU and the RAM
  4. The CPU is made up of the ALU and the CU
  5. The CPU is made up of the ALU and the RAM
  6. The CPU is made up of the CU and the RAM
  7. The CU is made up of the ALU and the CPU
  8. The CU is made up of the ALU and the RAM
  9. The CU is made up of the CPU and the RAM
  10. The RAM is made up of the ALU and the CPU
  11. The RAM is made up of the ALU and the CU
  12. The RAM is made up of the CPU and the CU

Question 18

___ are made of ___

  1. Electrons are made of logic gates
  2. Electrons are made of transistors
  3. Logic gates are made of electrons
  4. Logic gates are made of transistors
  5. Transistors are made of electrons
  6. Transistors are made of logic gates

Question 19

The ___ the transistors the ___ the computer.

  1. The larger the transistors the faster the computer.
  2. The larger the transistors the more reliable the computer.
  3. The smaller the transistors the faster the computer.
  4. The smaller the transistors the more reliable the computer.

Question 20

Consider a circuit with the following components:

If A and C are 1 and B is 0, what is the output of this circuit?

Question 21

Which of the following is true?

  1. The job of a compiler (converting source code into assembly code) is reversible: given the assembly, we can get back the source code.
  2. The job of an assembler (converting assembly code to machine instructions) is reversible: given the instructions, we can get back the assembly code.
  3. The job of an interpreter (converting source code into actions) is reversible: given the actions of the computer, we can get back the source code.

Question 22

What part of the following description of a computer program (written in a human-targeted pseudo-code, not in a programming language) is an example of variables?

How to take INFO 102:
  Do the following every week:
    1. Attend Monday lecture
    2. If you have a Tuesday lab, attend lab
    3. Attend Wednesday lecture
    4. If you have a Wednesday or Thursday lab, attend lab
    5. Do the homework
    6. If this is a quiz week, take the quiz
       Otherwise, attend Friday lecture

Do the following every semester:
  If your already took INFO 102, do not take INFO 102
  Otherwise, if your minor is Informatics, take INFO 102
  Otherwise, if INFO 102 sounds interesting, take INFO 102
  Otherwise, do not take INFO 102
  1. The place it says how to x and the indented lines after that.
  2. The reference to you/your.
  3. The several places it says if/otherwise.
  4. The two defined do the following every x and the indented lines after that.
  5. The two places it says take INFO 102.

Question 23

What part of the following description of a computer program (written in a human-targeted pseudo-code, not in a programming language) is an example of repetition?

How to take INFO 102:
  Do the following every week:
    1. Attend Monday lecture
    2. If you have a Tuesday lab, attend lab
    3. Attend Wednesday lecture
    4. If you have a Wednesday or Thursday lab, attend lab
    5. Do the homework
    6. If this is a quiz week, take the quiz
       Otherwise, attend Friday lecture

Do the following every semester:
  If your already took INFO 102, do not take INFO 102
  Otherwise, if your minor is Informatics, take INFO 102
  Otherwise, if INFO 102 sounds interesting, take INFO 102
  Otherwise, do not take INFO 102
  1. The place it says how to x and the indented lines after that.
  2. The reference to you/your.
  3. The several places it says if/otherwise.
  4. The two defined do the following every x and the indented lines after that.
  5. The two places it says take INFO 102.

Question 24

What part of the following description of a computer program (written in a human-targeted pseudo-code, not in a programming language) is an example of selection?

How to take INFO 102:
  Do the following every week:
    1. Attend Monday lecture
    2. If you have a Tuesday lab, attend lab
    3. Attend Wednesday lecture
    4. If you have a Wednesday or Thursday lab, attend lab
    5. Do the homework
    6. If this is a quiz week, take the quiz
       Otherwise, attend Friday lecture

Do the following every semester:
  If your already took INFO 102, do not take INFO 102
  Otherwise, if your minor is Informatics, take INFO 102
  Otherwise, if INFO 102 sounds interesting, take INFO 102
  Otherwise, do not take INFO 102
  1. The place it says how to x and the indented lines after that.
  2. The reference to you/your.
  3. The several places it says if/otherwise.
  4. The two defined do the following every x and the indented lines after that.
  5. The two places it says take INFO 102.

Question 25

What part of the following description of a computer program (written in a human-targeted pseudo-code, not in a programming language) is an example of function definition?

How to take INFO 102:
  Do the following every week:
    1. Attend Monday lecture
    2. If you have a Tuesday lab, attend lab
    3. Attend Wednesday lecture
    4. If you have a Wednesday or Thursday lab, attend lab
    5. Do the homework
    6. If this is a quiz week, take the quiz
       Otherwise, attend Friday lecture

Do the following every semester:
  If your already took INFO 102, do not take INFO 102
  Otherwise, if your minor is Informatics, take INFO 102
  Otherwise, if INFO 102 sounds interesting, take INFO 102
  Otherwise, do not take INFO 102
  1. The place it says how to x and the indented lines after that.
  2. The reference to you/your.
  3. The several places it says if/otherwise.
  4. The two defined do the following every x and the indented lines after that.
  5. The two places it says take INFO 102.

Question 26

What part of the following description of a computer program (written in a human-targeted pseudo-code, not in a programming language) is an example of function invocation?

How to take INFO 102:
  Do the following every week:
    1. Attend Monday lecture
    2. If you have a Tuesday lab, attend lab
    3. Attend Wednesday lecture
    4. If you have a Wednesday or Thursday lab, attend lab
    5. Do the homework
    6. If this is a quiz week, take the quiz
       Otherwise, attend Friday lecture

Do the following every semester:
  If your already took INFO 102, do not take INFO 102
  Otherwise, if your minor is Informatics, take INFO 102
  Otherwise, if INFO 102 sounds interesting, take INFO 102
  Otherwise, do not take INFO 102
  1. The place it says how to x and the indented lines after that.
  2. The reference to you/your.
  3. The several places it says if/otherwise.
  4. The two defined do the following every x and the indented lines after that.
  5. The two places it says take INFO 102.

Question 27

In response to a class question and on text we mentioned JSON, which is a computer language but not a programming language. JSON is not a programming language because

  1. it doesn’t describe what a computer should do
  2. it is an assembly language instead
  3. it is interpreted instead of compiled
  4. it isn’t popular enough

Question 28

The C language is the only language we discussed in the lectures comparing programming languages that is not memory-managed. We noted that lacking memory management makes it

  1. less flexible and less secure
  2. less flexible and more secure
  3. more flexible and less secure
  4. more flexible and more secure

Question 29

The C language is the only language we discussed in the lectures comparing programming languages that is compiled with no interpreter. We noted that being compiled makes its programs

  1. easier to create and faster to run
  2. easier to create and slower to run
  3. harder to create and faster to run
  4. harder to create and slower to run

Question 30

Why is it wise to pick a popular programming language?

  1. Communication is key: it’s easier to support programs in languages many people speak.
  2. Strength in numbers: cyber criminals are unlikely to target your code out of all the other options.
  3. The wisdom of the masses: they are popular because they are the best.

Question 31

Which of the following is an example of the detail removal form of abstraction?

  1. Describing how to reach an example classroom without learning if its the correct classroom to reach.
  2. Describing how to reach any classroom on campus without without listing them all in advance.
  3. Describing how to reach our classroom using the word walk without describing how to walk.
  4. Describing how to reach our classroom without referring to the time of day class meets.

Question 32

Which of the following is an example of the generalization form of abstraction?

  1. Describing how to reach an example classroom without learning if its the correct classroom to reach.
  2. Describing how to reach any classroom on campus without without listing them all in advance.
  3. Describing how to reach our classroom using the word walk without describing how to walk.
  4. Describing how to reach our classroom without referring to the time of day class meets.

Question 33

Where does the name algorithm come from?

  1. It’s an eponym based on the name al-Khwarizmi, who wrote an early book of algorithms.
  2. It’s an pun referring to US politician Al Gore’s sense of rhythm, inspired by his famous performance of the Macarena in the 1996 Democratic National Convention.
  3. It’s from the Latin root alga, the same root as algebra and algae, meaning to putrify, rot; in this case referring to how algorithms rot away the complexity of the problem until only the answer remains.

Question 34

Which of the following best defines the word algorithm?

  1. A precise series of instructions for computing an output from an input.
  2. A subroutine contained within a larger computer program.
  3. The rules used for base-10 place-value arithmetic.
  4. Those mathematical functions that can be computed by a Turing machine or an equivalently-powerful machine or language.

Question 35

Intractable is a property of

  1. algorithms
  2. both algorithms and problems
  3. problems

Question 36

Intractable generally pairs with which runtime?

  1. Constant O(1)
  2. Exponential O(2^n)
  3. Linear O(n)
  4. Logarithmic O(log n)
  5. Quadratic O(n^2)

Question 37

Which runtime suggests that only a few of the inputs are even looked at?

  1. Exponential O(2^n)
  2. Linear O(n)
  3. Logarithmic O(log n)
  4. Quadratic O(n^2)

Question 38

There is a famous, unsolved question of whether P = NP or P ≠ NP.

Much of modern computing is based on the assumption that

  1. P = NP
  2. P ≠ NP

Question 39

There is a famous, unsolved question of whether P = NP or P ≠ NP.

One way of framing this question is

  1. Are any problems impossible to solve in general?
  2. Are any problems impractical to solve for large inputs?
  3. Does every integer eventually reach one after repeated applications of 3n+1 when odd and n/2 when even?
  4. Does nanotechnology (N) change what a processor (P) can do?

Question 40

If a software developer tells you that your problem is NP-complete or NP-hard, but you need it for your application, you should

  1. Ask them how much hardware you’d need to buy to solve it anyway.
  2. Ask them to look into heuristics that approximate a solution instead.
  3. Explain the specific types of inputs you’re interested in and ask them to see if they can come up with something for just those cases.
  4. Rejoice! NP stands of no problem, you’re good to go.
  5. Weep! NP stands of not possible, your application can’t be done at all.

Question 41

If a software developer tells you that your problem is Undecidable, but you need it for your application, you should

  1. Ask them how much hardware you’d need to buy to solve it anyway.
  2. Ask them to look into heuristics that approximate a solution instead.
  3. Ask them why they can’t decide and what more you could tell them about the problem to help them make up their minds.
  4. Explain the specific types of inputs you’re interested in and ask them to see if they can come up with something for just those cases.

Question 42

If I have a reduction from A to B, or equivalently if I say that A reduces to B, that means:

  1. A and B solve the same problem, but A is simpler
  2. A and B solve the same problem, but B is simpler
  3. I have an algorithm that solves A and has solve B as a function call inside it
  4. I have an algorithm that solves B and has solve A as a function call inside it
  5. While solving A, I also solve B as a side effect or necessary step along the way
  6. While solving B, I also solve A as a side effect or necessary step along the way

2 All Lab Questions

Question 43

Convert this decimal number to binary: 137

Question 44

Convert this decimal number to binary: 117

Question 45

Convert this number into decimal: 0b100111

Question 46

Convert this number into decimal: 0b11100

Question 47

Convert this number into binary: 0xb0ba

Question 48

Convert this number into binary: 0xdead

Question 49

How many values can be represented by five bits?

Question 50

How many values can be represented by seven bits?

Question 51

Find C and D when A and B are 1 and 1

           _____
A -+------|     |
   |      | XOR |--------- C
B-----+---|_____|
   |  |
   |  |          _____
   |  +---------|     |
   |  _____     |     |
   | |     |    | AND |--- D
   +-| NOT |----|     |
     |_____|    |_____|

Question 52

Find C when A and B are 0 and 0

        _____
A -----|     |
       | AND |--+
B--+---|_____|  |
   |            |    _____
   |            +---|     |
   |  _____         |     |
   | |     |        | OR  |--- C
   +-| NOT |--------|     |
     |_____|        |_____|

Question 53

How many gigabytes are there in a terabyte?

Question 54

How many megabytes are in a petabyte?

Question 55

Order from the fastest language to the slowest language:

Question 56

Which of these languages are Turing Complete?

Question 57

What are at least four factors you should consider when choosing a programming language?

Question 58

What is an algorithm?

Question 59

How do heuristics differ from other algorithms?

Question 60

How does data differ from information?

Question 61

What are some important characteristics that people should think about when choosing between different algorithms?

Question 62

What is the definition of intractable?

Question 63

What time complexity is always considered intractable?

Question 64

Draw a graph that represents these 4 cities and the distances between them. The nodes should represent the cities. The edges should represent the distance between the cities.

and Bloomington and Peoria and Springfield
Between Urbana 54 miles 93 miles 92 miles
Between Bloomington 38 miles 68 miles
Between Peoria 74 miles

Question 65

What is the time complexity of the Traveling Salesman problem?