

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A quiz for students in cse 11 (computer science fundamentals i) covering operator precedence, logical operators, and turtle graphics. The quiz includes multiple-choice questions, a coding challenge, and a java programming exercise. Students are required to determine the values of variables after code execution, write java expressions without using negation operators, draw a t shape using turtle graphics, and evaluate equality and inheritance between objects.
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!


x =
y =
z =
a =
b =
c =
What results would be produced by evaluating the following expressions (left to right; top to bottom)?
p1 == p2 ____________ p1 == p3 ____________ p2 == p3 ____________
p1.equals(p2) ____________ p1.equals(p3) ____________ p2.equals(p3) ____________
p1.translate(1, 1); // Add 1 to the x and y coordinates in the Point object ref'ed by p
p1.equals(p2) ____________ p1.equals(p3) ____________ p2.equals(p3) ____________
p2.translate(1, 1); // Add 1 to the x and y coordinates in the Point object ref'ed by p
p1.equals(p2) ____________ p1.equals(p3) ____________ p2.equals(p3) ____________
p3.translate(1, 1); // Add 1 to the x and y coordinates in the Point object ref'ed by p
p1.equals(p2) ____________ p1.equals(p3) ____________ p2.equals(p3) ____________
Quiz2 q2 = new Quiz2();
q2.method1( 11 );
public class Quiz { private int a; // Line 3
public void method1( int x ) { int a; // Line 7 int b = x;
a = b % 5; this.a = b / 3;
System.out.println( "a = " + a ); System.out.println( "b = " + b ); System.out.println( "this.a = " + this.a ); System.out.println( "method2() result = " + method2( x ) ); System.out.println( "a = " + a ); System.out.println( "b = " + b ); System.out.println( "this.a = " + this.a ); }
private int method2( int x ) { int a = x; int b = this.a;
b = b * 2;
System.out.println( "a = " + a ); System.out.println( "b = " + b ); System.out.println( "this.a = " + this.a );
this.a = b + 3;
return a + 3; } }
What is the initial value of a on Line 7? ______________
What is the initial value of a on Line 3? ______________
Output:
a = __________ b = __________ this.a = __________ a = __________ b = __________ this.a = __________ method2() result = __________ a = __________ b = __________ this.a = __________