Computer Science: Programming with a Purpose Week 5 Quiz Answer

Computer Science Programming with a Purpose Week 5 Quiz Answer

Computer Science: Programming with a Purpose Week 5 Quiz Answer


In this article i am gone to share Coursera Course Computer Science: Programming with a Purpose Week 5 | Functions and Libraries Quiz Answer with you..


Functions and Libraries



Question 1)
Which of the following appear in a method's signature? Mark all that apply.
  • method body
  • method name
  • return statement
  • parameter variable types
  • parameter variable names



Question 2)
Which of the following is a variable's scope in a Java library?
  • all the code in the same block as the declaration
  • all the code following the declaration, in the same block
  • all the code in the library following the declaration
  • all the code in the same method as the declaration
  • all the code in the library



Question 3)
Consider this static method:

public static String duplicate (String s)
{
  String t - s+ s;
  return t;
}

What does this code fragment print?

String s1 = "Hi";
s1 = duplicate (s1) ;
String t1 = "Bye";
t1 = duplicate(duplicate (t1));
StdOut.println (s1 + t1):

  • HiHIByeByeByeBye



Question 4)
Which of the following are properties of modular programming? Mark all that apply.
  • Enables code reuse
  • Complicates debugging
  • Separation of clients from implementations
  • Independent development of programs of manageable size
  • Development of all the code for a task within a single module











Post a Comment

0 Comments