Reading Quiz Questions
These are the questions that will appear on the reading quizzes in week 5. Remember these quizzes take place at the start of class, and you get points for correctness, not just participation. These will be the exact questions we ask you. They will be multiple choice clicker questions, but we do not provide the answer choice here. If you can answer them without the answer choices, you'll have no problems answering them when you see the choices. These are not designed to be overly tricky.
Monday, February 4th
1. public Picture scaleUp(int numTimes)
{
......
}
If this is the method definition in Picture.java what is the method call for a Picture object named pictObj that returns a Picture object?
2. When can I define two methods with the same name in the same class?
{
......
}
If this is the method definition in Picture.java what is the method call for a Picture object named pictObj that returns a Picture object?
2. When can I define two methods with the same name in the same class?
Wednesday, February 6th
1. If I wanted the following lines to print “if statement was true” what could go in the blank to do this?
int x = 30;
if(_______)
System.out.println(“if statement was true);
2. What is the correct way to fill in the blank so that the code below will print "Hello!" if x is equal to 10:
int x = 0;
if (_________________)
{
System.out.println( "Hello!" )
}
int x = 30;
if(_______)
System.out.println(“if statement was true);
2. What is the correct way to fill in the blank so that the code below will print "Hello!" if x is equal to 10:
int x = 0;
if (_________________)
{
System.out.println( "Hello!" )
}
Friday, February 8th
1. What gets printed in the following:
int x = 15, r = 10;
if(x < 15)
{
x = 100;
}
else
{
r = r + 20;
}
System.out.prinln(x+r);
2. What does the code below print?
int x = 6;
if (x>10)
{
System.out.println("Dogs can fly");
}
if(x>7)
{
System.out.println("Cats can drive");
}
else{
System.out.println("Non-Sensical nonsense");
}
int x = 15, r = 10;
if(x < 15)
{
x = 100;
}
else
{
r = r + 20;
}
System.out.prinln(x+r);
2. What does the code below print?
int x = 6;
if (x>10)
{
System.out.println("Dogs can fly");
}
if(x>7)
{
System.out.println("Cats can drive");
}
else{
System.out.println("Non-Sensical nonsense");
}