The basis for education in the last millennium was “reading, writing, and arithmetic;” now it is reading, writing, and computing. Learning to program is an essential part of the education of every student, not just in the sciences and engineering, but in the arts, social sciences, and humanities, as well. Beyond direct applications, it is the first step in understanding the nature of computer science’s undeniable impact on the modern world. 

This course covers the first half of our book Computer Science: An Interdisciplinary Approach (the second half is covered in our Coursera course Computer Science: Algorithms, Theory, and Machines). 

Our intent is to teach programming to those who need or want to learn it, in a scientific context. 

You can enroll here:

Computer Science: Programming with a Purpose Week 6 Quiz Answers - Coursera!

Coursera Computer Science: Programming with a Purpose Week 6 Quiz Answers!


Question 1) Which of the following are broadly useful approaches for solving problems by combining solutions to smaller subproblems? Mark all that apply.

exponential waste
dynamic programming
conditional programming

Question 2) Give the value of Q2(6)

public static int Q2(int n)
   if (n <= 0) return 1;
     return 1+ Q2(n-2) +Q2(n-3);

Answer: 13

Question 3) Give the 10th integer printed by a call to Q3(6).

public static void Q3(int n)
  if (n <= 0) return;

Answer: 13

Question 4) Give the number of integers printed bya call to Q4(7).

public static void Q4(int n)
  if (n <= 0) return;
  stdout.println (n) ;
  Q4 (n-2);
  stdout.println (n);

Answer: 16

Question 5) Give the value of Q5(8).

  int[] b = new int[n+1];
  b[0] 1;
  for (int i = 2; i <=n; i++)
     b[i] = 0;
     for (int j = 0; j< i; j++)
          b[i] += b[jl;
   return b[n];

Answer: 64

Post a Comment

Previous Post Next Post