Comp Sci 200 final review
with 100% correct answers
What will print out:
Double d1 = new Double(10);
double d2 = d1;
d1 = 14.1;
System.out.print(d2); - answer 14.1
What is printed:
String s1 = "hello";
String s2 = new String("hello");
String s3 = "hello";
System.out.print(s1 == s3); - answer true
What is printed:
String s1 = "hello";
String s2 = new String("hello");
String s3 = "hello";
System.out.print(s1 == s2); - answer false
What will be printed:
, double d1 = 8.1;
if (d1 == 8.1 ) {
System.out.println("equal")
} else {
System.out.println("not equal")
} - answer not equal
are classes stored on the stack or heap? - answer
heap
a type of UML - behavior diagram, how external
users interact with the system - answer use case
design
type of UML diagram - shows structure of a system
with features, constraints and relationships.
Independent of time - answer class diagram
type of UML diagram - snapshot of a system at a
point in time, instances of classes with specific
values - answer object diagram
type of UML diagram - behavior diagram, shows
flow of control emphasizing sequence and
conditions - answer activity diagram
with 100% correct answers
What will print out:
Double d1 = new Double(10);
double d2 = d1;
d1 = 14.1;
System.out.print(d2); - answer 14.1
What is printed:
String s1 = "hello";
String s2 = new String("hello");
String s3 = "hello";
System.out.print(s1 == s3); - answer true
What is printed:
String s1 = "hello";
String s2 = new String("hello");
String s3 = "hello";
System.out.print(s1 == s2); - answer false
What will be printed:
, double d1 = 8.1;
if (d1 == 8.1 ) {
System.out.println("equal")
} else {
System.out.println("not equal")
} - answer not equal
are classes stored on the stack or heap? - answer
heap
a type of UML - behavior diagram, how external
users interact with the system - answer use case
design
type of UML diagram - shows structure of a system
with features, constraints and relationships.
Independent of time - answer class diagram
type of UML diagram - snapshot of a system at a
point in time, instances of classes with specific
values - answer object diagram
type of UML diagram - behavior diagram, shows
flow of control emphasizing sequence and
conditions - answer activity diagram