coding interview preparation coursera week 2 quiz answers

Knowledge check: Basic data structures

1. What does it mean to say a Data Structure is a first-class object?

  • This means that a data structure can be passed to a function, returned as a result and generally treated like any other variable.
  • They are not memory intensive.
  • It is very quick at retrieving and storing data.

2. What does it mean to parse a string?

  • To pass it to the compiler to execute instructions.
  • To remove symbols and uppercases from a string of text.
  • To remove items from a string not based on a given format.

3. How many bytes does it normally take to represent a standard int?

  • 16
  • 4
  • 8

4. A Boolean answer is one that will be either true or false?

  • True
  • False

5. Is it possible to copy an array?

  • No.
  • Yes, but only through making a deep-copy.
  • Yes, but only through making a shallow-copy.

Knowledge check: Collection data structures

6. You wish to store a list of grades for a class. Given the choice between a set and a list, which is the more appropriate data structure?

  • List
  • Set
  • Either would do

7. In relation to data structures what does mutability mean?

  • It means that it can be changed after it has been created.
  • It means that once an object is created it cannot be changed.
  • It relates to dynamic programming languages, and it can be passed as a variable to a function.

8. LIFO and FILO mean the same thing?

  • True
  • False

Shuffle Q/A 1

9. Creating a class through the use of a capital T as below: Stack, is an example of what?

  • Generics
  • Immutability
  • Encapsulation

10. On what type of data structure would one do a depth first search?

  • Stacks
  • Lists
  • Trees

Leave a Reply