ITSC 1213 ALL LAB QUIZ QUESTION AND CORRECT ANSWERS
Correct 69
Incorrect 00
1 of 69
Term
what would be the effect of the following code?
public class BodyPart {}
public class Leg extends BodyPart{}
Lag l = new BodyPart();
Give this one a try later!
a compiler error because a
a compilation error because the leg
subclass reference variable
class does not override the bodypart
cannot be assigned a
constructor
superclass object
a runtime exception because the leg a runtime error because the leg
object is not compatible with the object is being cast to a superclass
bodypart type type
, Don't know?
2 of 69
Term
given the following definitions:
public abstract class Manager extends Employee()
public class Executive extends Manager()
what if anything, is wrong with the following code?
public class hrSystem{
public void payRaise(){
Manager m = new Manager();
}
}
Give this one a try later!
Compiler error because
No error, the Code is perfectly valid
Manager is abstract so an
and will execute without issue.
instance cannot be created.
Compiler error because Executive Runtime error because the payRaise
cannot extend Manager if Manager is method is not defined in the
abstract. hrSystem class.
Don't know?
, 3 of 69
Term
a try block can be followed by
Give this one a try later!
one or more finally blocks one or more catch blocks
a return statement only a finally block only
Don't know?
4 of 69
Term
given the following code:
public ______ class Foo {
public void bar1()(. )
public abstract voidbar2 ():
}
Give this one a try later!
Static Final
, Public Abstract
Don't know?
5 of 69
Term
public
Give this one a try later!
accessible from outside or
accessible only by subclasses
inside the class
accessible only within the same accessible only inside the class
package definition
Don't know?
6 of 69
Term
can you use overridden and overloaded methods in the same class?
Give this one a try later!
Correct 69
Incorrect 00
1 of 69
Term
what would be the effect of the following code?
public class BodyPart {}
public class Leg extends BodyPart{}
Lag l = new BodyPart();
Give this one a try later!
a compiler error because a
a compilation error because the leg
subclass reference variable
class does not override the bodypart
cannot be assigned a
constructor
superclass object
a runtime exception because the leg a runtime error because the leg
object is not compatible with the object is being cast to a superclass
bodypart type type
, Don't know?
2 of 69
Term
given the following definitions:
public abstract class Manager extends Employee()
public class Executive extends Manager()
what if anything, is wrong with the following code?
public class hrSystem{
public void payRaise(){
Manager m = new Manager();
}
}
Give this one a try later!
Compiler error because
No error, the Code is perfectly valid
Manager is abstract so an
and will execute without issue.
instance cannot be created.
Compiler error because Executive Runtime error because the payRaise
cannot extend Manager if Manager is method is not defined in the
abstract. hrSystem class.
Don't know?
, 3 of 69
Term
a try block can be followed by
Give this one a try later!
one or more finally blocks one or more catch blocks
a return statement only a finally block only
Don't know?
4 of 69
Term
given the following code:
public ______ class Foo {
public void bar1()(. )
public abstract voidbar2 ():
}
Give this one a try later!
Static Final
, Public Abstract
Don't know?
5 of 69
Term
public
Give this one a try later!
accessible from outside or
accessible only by subclasses
inside the class
accessible only within the same accessible only inside the class
package definition
Don't know?
6 of 69
Term
can you use overridden and overloaded methods in the same class?
Give this one a try later!