Computer Science: Algorithms, Theory, and Machines Quiz Answers

Get All Weeks Computer Science: Algorithms, Theory, and Machines Quiz Answers

This course introduces the broader discipline of computer science to people having basic familiarity with Java programming. It covers the second half of our book Computer Science: An Interdisciplinary Approach (the first half is covered in our Coursera course Computer Science: Programming with a Purpose, to be released in the fall of 2018). Our intent is to demystify computation and to build awareness about the substantial intellectual underpinnings and rich history of the field of computer science.

First, we introduce classic algorithms along with scientific techniques for evaluating performance, in the context of modern applications. Next, we introduce classic theoretical models that allow us to address fundamental questions about computation, such as computability, universality, and intractability. We conclude with machine architecture (including machine-language programming and its relationship to coding in Java) and logic design (including a full CPU design built from the ground up). The course emphasizes the relationships between applications programming, the theory of computation, real computers, and the field’s history and evolution, including the nature of the contributions of Boole, Shannon, Turing, von Neumann, and others. All the features of this course are available for free. No certificate will be offered upon completion.

Enroll on Coursera

Computer Science: Algorithms, Theory, and Machines Quiz Answers

Week 01

Sorting and Searching

Q1. Which of the following results from using a blacklist filter (check all that apply)?

  • Denies service to known untrustworthy clients
  • Denies service to unknown clients
  • Allows service to trusted clients
  • Allows service to unknown clients

Q2. Suppose that an array of strings contains [“blueberry”, “chocolate”, “coconut”, “coffee”, “mint”, “strawberry”, “vanilla”]. How many compares are used for a unsuccessful search for “pistachio” with binary search?

  • 2
  • 3
  • 4
  • 5
  • 6

Q3. Which of the following running times for a program sorting N 10-character strings is consistent with the hypothesis that the program is using insertion sort? Mark all that apply.

  • 1 second for N = 10,000, 4 seconds for N = 20,000, 256 seconds for N = 160,000
  • 1 second for N = 1,000,000, 4 seconds for N = 2,000,000, 8 seconds for N = 4,000,000
  • 1 second for N = 10,000, 4 seconds for N = 20,000, 64 seconds for N = 80,000
  • 1 second for N = 1,000,000, 4 seconds for N = 2,000,000, 16 seconds for N = 4,000,000
  • 1 second for N = 10,000, 2 seconds for N = 20,000, 16 seconds for N = 160,000

Q4. Which of the following best describes the order of growth of the worst-case running time of sequential search?

  • logarithmic
  • linear
  • linearithmic
  • quadratic

Week 02

Stacks and Queues

Q1. Suppose that you start with an empty stack and interpret a letter to mean push and – to mean pop. Mark the sequences below that leave e at the bottom of the stack.

  • a – b c – – d – e f g – h
  • a – b c – d – e – f g – h
  • a – b – c – d – e f g – h
  • a b c d – – – – e f g – h
  • a – b c – – d – e f g h –

Q2. Which of the following is the primary reason to use generics when implementing stacks and queues?

  • More space-efficient than using primitive types
  • Makes it possible to have stacks and queues holding objects of mixed types
  • Eliminates need to have multiple implementations for different types
  • More time-efficient than using primitive types
  • Makes it possible to meet the performance specifications

Q3. When does a data type not implement the Stack API? Mark all that apply.

  • When the operation of removing an arbitrary item is supported
  • When the space required cannot be bounded by a constant times the number of items in the stack at all time
  • When the only operations that modify the stack are to insert an item and to remove the most recently inserted item
  • When the order of growth of the time required to insert an item is logarithmic
  • When the maximum size of the stack needs to be specified ahead of time
  • When the only operations that modify the stack are to insert an item and to remove the least recently inserted item

Q4. For which of the following expressions is the maximum stack size the largest when evaluated with the Postfix client given in lecture?

  • 1 1 1 1 + * 1 1 + 1 *
  • 1 1 + 1 1 + * 1 1 * +
  • 1 1 1 1 1 1 + + * + *
  • 1 1 + 1 1 + * 1 + 1 +
  • 1 1 1 + 1 + * 1 + 1 *

Week 03

Symbol Tables

Q1. Which of the following are reasons to have ordered keys in a symbol-table API?

  • They make it simpler to support iteration
  • They arise naturally in many applications
  • Implementations can take advantage of ordering to gain efficiency
  • They allow for useful extensions to the API
  • They make it possible to support multiple types of data

Q2. Of the following, which is the most important reason not to use a linked list for a symbol-table implementation?

  • Doesn’t support ordered keys
  • Not scalable because search is too slow
  • Uses too much space
  • None of the above
  • Not scalable because insertion is too slow

Q3. In the BST built from the keys “is this an easy question” which key is in the root of the left subtree of the root?

  • question
  • an
  • is
  • this
  • easy

Q4. Of the following, which is most likely to be closest to the height of a red-black tree with 1 million nodes?

  • 10
  • 100
  • 1000
  • 10000
  • 100000

Week 04

Theory of Computing

Q1. Which of the following strings matches the RE a*bb(ab|ba)* ?

  • aaaaaabbababababbaab
  • abbababbabaabbaabbaabbabba
  • bbbb
  • bbabbabaabaaab
  • aaabbaaa

Q2. Consider a two-state DFA with a binary alphabet having the following transitions: Stay in state 0 if the input is 0 and stay in state 1 if the input is 1, otherwise switch to the other state. If state 0 is the accept state, which of the following does this DFA accept?

  • Bitstrings with at least one 0
  • Bitstrings with an equal number of occurrences of 01 and 10
  • Bitstrings that end in 0
  • Bitstrings with more 0s than 1s
  • Bitstrings with an equal number of occurrences of 0 and 1

Q3. Which of the following strings matches the generalized RE [$_A-Za-z][$_A-Za-z0-9]* ? Mark all that apply.

  • 23abcxyz
  • 123456
  • $
  • $ABABab$
  • abcxyz23

Q4. Which of the following statements are true? Mark all that apply.

  • Every DFA can be simulated by some NFA
  • Every NFA can be simulated by some DFA
  • All formal languages are regular
  • Every formal language can be recognized by some NFA
  • NFAs and REs are equivalent

Week 05

Turing Machines

Q1. Which of the following properties are common to both Turing machines are and DFAs? Mark all that apply.

  • No limit on number of steps
  • Simple model of computation
  • Finite number of states
  • Can read from or write onto the tape
  • State transitions are determined by current state and input symbol
  • Input on tape is a finite string with symbols from a finite alphabet

Q2.Which of the following models of computation are universal? Mark all that apply.

  • Java
  • Conway’s Game of Life
  • NFAs
  • your mobile phone
  • Turing machines
  • regular expressions

Q3. Which of the following best characterizes the following statement: “There exists a mathematical function that can be computed in Java, but cannot be computed on a Turing machine.

1 point

  • known to be false
  • known to be true
  • truth or falsity not known
  • if true would prove the Church–Turing thesis
  • if true would falsify the Church–Turing thesis

Q4. Which of the following problems is undecidable?

  • Do two given programs always print the same value?
  • Is every variable in a given program initialized before it is used?
  • Is every statement in a given program executed at least once?
  • Does a given program contain a computer virus?
  • All of the above

Week 06

Intractability

Q1. Assume that checking a box below corresponds to setting the variable to 1 and leaving it unchecked corresponds to setting it to 0. Give settings that solve the integer programming problem for the equations v+w+x ≥ 1, w+x+y ≥ 2, x+y+z ≥ 3, v+x+z ≥ 2, and v+w+x+y+z ≤ 3.

  • v
  • w
  • x
  • y
  • z

Q2. Assume that P = NP. Mark all correct options for FACTOR.

  • is computable
  • is in NP
  • is NP-complete
  • is intractable
  • is in P

Q3. Let A and B be two decision problems. Suppose we know that A polynomial-time reduces to B. Which of the following can we infer? Mark all that apply.

  • A and B cannot both be NP-complete
  • If A is NP-complete then so is B
  • If B is NP-complete and A is in NP then A is NP-complete
  • If B is in P, then A is in P
  • If A is in P, then B is in P
  • If A is NP-complete and B is in NP then B is NP-complete
  • If B is NP-complete then so is A

Q4. Which of the following can we infer from the fact that a problem is NP-complete, if we assume that P ≠ NP? Mark all that apply.

  • No algorithm exists that solves arbitrary instances of the problem
  • No algorithm exists that efficiently solves arbitrary instances of the problem
  • There exists an algorithm that efficiently solves arbitrary instances of the problem, but no one has been able to find it
  • The problem is not in P
  • All algorithms that are guaranteed to solve the problem run in polynomial time for some family of inputs
  • All algorithms that are guaranteed to solve the problem run in exponential time for all families of inputs

Week 07

A Computing Machine

Q1. Which of the following is the 4-digit hexadecimal two’s complement representation of the decimal number –16?

  • 0010
  • 0011
  • FFF0
  • FFF1
  • FF16

Q2. Which of the following are components of a machine’s state (value at the beginning of each instruction cycle determines what happens next)? Mark all that apply.

  • IR
  • ALU
  • PC
  • Memory
  • Registers

Q3. Suppose that R[2] contains a small integer x. Which of the following describes the value in R[2] after the instruction 5222 is executed?

  • 0
  • xx
  • 2×2x
  • 2^x2x
  • x2^xx2x

Q4. Suppose that the following sequence of instructions is loaded into memory locations 10-16: 10: 7C0A 11: 7101 12: 7201 13: 1222 14: 2CC1 15: DC13 16: 0000 and you set the PC to 10 and press RUN. Give the decimal number represented by the contents of R[2] when the machine halts.

Week 08

von Neumann Machines

Q1. Suppose that the following sequence of instructions is loaded into memory locations 10-14: 10: 8113 11: 2111 12: 9113 13: 8113 14: 0000 and you set the PC to 10 and press RUN. What is the contents of R[1] when the machine halts?

  • FFFF
  • 8113
  • 0000
  • 9113
  • 2111

Q2. Which of the following are programs that process programs? Mark all that apply.

  • ALU
  • Java Virtual Machine
  • Assembler
  • Compiler
  • Interpreter

Q3. Which of the following are (approximately) true of your cellphone, as compared to von Neumann’s EDVAC? Mark all that apply.

  • thousands of times faster
  • thousands of times more memory
  • millions of times smaller
  • millions of times faster
  • thousands of times smaller
  • millions of times more memory

Q4. Which of the following are true about virtual machines? Mark all that apply.

  • They allow software to be prepared for a new computer before it is built.
  • They are faster and have more memory than real machines.
  • They allow for backwards capability.
  • They are generally too expensive to be useful in modern computing.
  • They cannot be implemented on von Neumann machines.

Week 09

Combinational Circuits

Q1. How many different Boolean functions of 4 variables are there?

  • 4
  • 16
  • 64
  • 1024
  • 65536

Q2. Suppose that one input of a NAND gate is set to x and the other is set to 1. Which function of x does it compute?

  • 0
  • 1
  • x
  • x’
  • x+1

Q3. By checking a box for 1 and leaving it unchecked for 0, give the truth table column that defines the EVEN PARITY Boolean function of 3 variables.

  • 0 0 0
  • 0 0 1
  • 0 1 0
  • 0 1 1
  • 1 0 0
  • 1 0 1
  • 1 1 0
  • 1 1 1

Q4. Which of the following circuits have 4 outputs? Mark all that apply.

  • 2-bit majority
  • 4-bit decoder
  • 2-bit decoder
  • 4-bit adder
  • 4-bit ALU

Week 10

CPU

Q1. Which of the following modules are found in a memory? Mark all that apply.

  • odd parity
  • majority
  • flip–flop
  • multiplexer
  • decoder

Q2. Which of the following are not combinational circuits? Mark all that apply.

  • CLOCK
  • ALU
  • CONTROL
  • MEMORY
  • INCREMENTER

Q3. Which of the following decodes instructions?

  • ALU
  • CLOCK
  • CONTROL
  • MEMORY
  • PC

Q4. How many flip–flops are in the TOY-8 CPU?

  • 128
  • 132
  • 136
  • 148
  • 149
Computer Science: Algorithms, Theory, and Machines Course Review:

In our experience, we suggest you enroll in Computer Science: Algorithms, Theory, and Machines courses and gain some new skills from Professionals completely free and we assure you will be worth it.

Computer Science: Algorithms, Theory, and Machines course is available on Coursera for free, if you are stuck anywhere between a quiz or a graded assessment quiz, just visit Networking Funda to get Computer Science: Algorithms, Theory, and Machines Quiz Answers.

Conclusion:

I hope this Computer Science: Algorithms, Theory, and Machines Quiz Answers would be useful for you to learn something new from this Course. If it helped you then don’t forget to bookmark our site for more Quiz Answers.

This course is intended for audiences of all experiences who are interested in learning about new skills in a business context; there are no prerequisite courses.

Keep Learning!

Leave a Reply

Your email address will not be published.

error: Content is protected !!