coding interview preparation coursera week 1 quiz answers

Knowledge check: The coding interview

1. What are softskills?

  • They relate to the way you conduct yourself social.
  • Coding skills that improve presentation of code.
  • Skills that you would not feel very competent at.

2. When are you most likely to be asked about your Softskills?

  • During a technical interview.
  • During a quiz.
  • During a screening call.

3. What is the purpose of the online coding assignment?

  • To help you get into the mindset of working for this company before you start
  • It is designed to give you an opportunity to show what you can produce in an unpressurized environment that mimics potential job activities you will be asked to undertake
  • It is to get you to solve some company problem

4. Pseudocode is a structured way to engage with code.

  • True
  • False

5. When should you test your code?

  • Continuously as the project progress.
  • At the end.
  • Whenever the application crashes to identify what the issue is.

Knowledge check: Time complexity

6. Which has the largest time to compute?

  • O(log n)
  • O(N)
  • O(1)

7. Given the following lines of code pseudocode;

N = 7

FOR i = 1 TO N:

output(i)

  • O(N)
  • O(1)
  • O(n^2)

8. Given the following lines of code pseudocode;

N = 7

FOR i = 1 TO N:

FOR j = 1 TO N:

output(N)

  • O(N)
  • O(n^2)
  • O(1)

9. Given the following lines of code pseudocode:

N = 37

FOR i = 1 TO N:

WHILE i < 10:

output(i*N)

  • O(1)
  • O(N)
  • O(n^2)

10. Given the following lines of code pseudocode;

N = 37

FOR i = 1 TO N:

WHILE i < 10:

output(i*N)

  • O(N)
  • O(1)
  • O(n^2)

11. Given the following lines of code pseudocode:

N = 10

FOR i = 1 TO 5:

FOR j = 1 TO i:

output(i*j)

  • O(Log N)
  • O(1)
  • O(n^2)

12. Given the following lines of code pseudocode: output(N)

N = 7

FOR i = 1 TO N:

FOR j = 1 TO N:

output(N)

  • O(1)
  • O(N)
  • O(n^2)

Knowledge check: Space complexity

13. Given an array that holds 12 integers at 4bytes per integer, contains an additional 12 bytes for the header and 4 bytes for padding. What is the total space complexity for this data structure?

  • 16
  • 48
  • 64

14. A program requires two arrays to compute a function. First array has a header of 12 bytes, and padding of another 4 bytes. It contains 8 integers of 4 bytes each. The second array also has a header of 12 bytes and 4 bytes padding. The second array contains 24 integers of 4 bytes each. What is the input space of this function?

  • 160
  • 128
  • 32

15. Changing the values in an array leads to greater space complexity over creating a new array and copying in the values?

  • True
  • False

16. Does reducing the space complexity of a function increase the time complexity?

  • Yes
  • No

17. What does auxiliary space refer to?

  • Virtual memory
  • The space used to store data that the CPU is processing
  • It is the space required to hold any additional variables used in the computations of an application.

Module quiz: Introduction to the coding interview

18. What should be done when presented with a technical problem where the solution is not immediately obvious?

  • Ask the interviewer how they would solve the problem.
  • Ask questions.
  • Move the conversation along and try not to draw attention.

19. During a technical interview, is it better to rely on the work of others, or code everything yourself?

  • Use code written by others.
  • Use the data structures, but don’t use any other external implementation.
  • Write as much code as you can to show off your skills.

20. Given an array that represents sock colors: Sock_colors = [3,3,2,1,1,3,5,1,4,2], how many pairs of the same color socks exist?

  • 4
  • 3
  • 2

21. It is best to remain silent when writing code during a technical interview.

  • True
  • False

22. Should I ask questions in an interview?

  • Yes, but only when the conversation looks like it is going to help the interviewer along.
  • Yes. Ask questions for clarity or during an appropriate time.
  • Yes. Asking questions can run down the interview clock and so avoid awkward questions.

23. What is the STAR method?

  • A structured approach to answering questions.
  • A coding practice with 4 key components.
  • A stellar answer to a good question.

24. What is meant by transfer rate in relation to a CPU?

  • The rate at which instructions are processed.
  • The rate at which a processor can convert input from a terminal.
  • The rate at which memory is transferred into cache.

25. When engaged with a coding interview what sorts of tests should you aim to include?

  • Integration tests
  • Functional tests
  • Unit tests

26. Which memory location is closest to the CPU?

  • Main memory
  • Secondary memory
  • Cache

27. When designing a solution it is best to:

  • Doing a quick sketch then implementing everything on the page.
  • Tackle every problem as it arises.
  • Planning an outline, engaging the main obstacles, looking at the potential solutions and constantly reviewing.

Leave a Reply