1/18
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
the major difference between stack memory and heap memory is that the stack is used to store the order of method execution and local variables while the heap memory stores the objects and it uses dynamic memory allocation and deallocation
true or false
true
in java, the default value for a class variable of type int
is -1.
true or false
false
instance variables are used to represent an object’s state
true or false
true
subclasses can access private instance variables of the superclass
true or false
false
when writing regression tests, it is ok to directly interact with private variables
true or false
false
a uml use case diagram is considered a behavioural diagram, as opposed to a structural diagram
true or false
true
in Java, the toString() method automatically collects a class’ attributes and generates a formatted Strinag representation of the class
true or false
false
you need to provide the size of an arrayList when you are creatin the arrayList
true or false
false
polymorphism can be used with both inherit super types and implemented supertypes
true or falsea
false
which of the following is not a class found in java’s collection framework
arraylist
hashmap
hashset
dictionary
dictionary
which of the following are not important for a regression test program?
constructing objects are calling methods
displaing the results of the method calls
displaying the values that you expect to get
reading input from the user
reading input from the user
suppose the class coffee extends the class drink. which one of the following assignments is legal?
drink x = new drink();
coffee y = new coffee();
a) y = x;
b) x = y;
c) y = new drink();
d) new drink() = new coffee();
x = y;
suppose you are to design an inheritance hierarchy with the following classes: mouse, cat, mammal, and tiger. which of these is the superclass?
a) tiger
b) mammal
c) mouse
d) cat
mammal
which programming technique should be used if you want a method to have different behaviour depending on the class of the object that is invoking it?
polymorphism
the instaceof operator
an if-else statement
the getclass method
polymorphism
which of the following java
snippets would be used to declare a hashmap
that contains items of type exam
and is accessed by a key of type string
?
a. hashmap<exam> exams = new hashmap<string>();
b. hashmap<t> exams = new hashmap<t>();
c. map<exam, string> exams = new hashmap<exam, string>();
d. map<string, exam> exams = new hashmap<string, exam>();
d. map<string, exam> exams = new hashmap<string, exam>();
when should you delete your testing code from a class?'
if it is a simple class you don’t need to write proper regression tests
when all tests are passed and you know the class wont be changing
your regression tests should never be deleted
after several months without errors it makes sense to delete your tests to make your code easier to read
your regression tests should never be deleted
consider the following code fragment:
Object obj = “CMPT 270”;
System.out.println(ob.length());
which of the following statements are true?
a) the code compiles are runs without issue
b) the code will not compile because the Object class does not have a method called length()
c) the code will not compile because a String object cannot be assigned to something of type object
d) the code will compile but throw an exception
the code will not compile because the Object class does not have a method called length()
instance variables are used to model the attributes of an object
true or false
true
if your code contains an error, there will always be atleast one corresponding fault
true or false
false