click below
click below
Normal Size Small Size show me how
OOP (LEC) - FA 4
| Question | Answer |
|---|---|
| An interface is typically used in place of an abstract class when there is no default implementation to inherit. Group of answer choices false true | An interface is typically used in place of an abstract class when there is no default implementation to inherit. Group of answer choices false true // |
| What does the name Polymorphism translate to? Group of answer choices Many changes two forms liquid forms Many forms | What does the name Polymorphism translate to? Group of answer choices Many changes two forms liquid forms Many forms// |
| Polymorphism is possible in JAVA language. Group of answer choices False True | Polymorphism is possible in JAVA language. Group of answer choices False True// |
| Polymorphism is a feature of object oriented programming. Group of answer choices False True | Polymorphism is a feature of object oriented programming. Group of answer choices False True// |
| Polymorphism enables objects of different classes that are related by a class hierarchy to be processed generically Group of answer choices true false | Polymorphism enables objects of different classes that are related by a class hierarchy to be processed generically Group of answer choices true// false |
| Which of the following classes fail to compile? abstract class X { abstract void method(); } abstract class Y extends X { void Method() { } } class Z extends X { void method() { } } Group of answer choices X Y All classes compile Z | Which of the following classes fail to compile? abstract class X { abstract void method(); } abstract class Y extends X { void Method() { } } class Z extends X { void method() { } } Group of answer choices X Y X All classes compile Z X |
| Which among the following is not a level of abstraction? Group of answer choices Physical level External level View level Logical level | Which among the following is not a level of abstraction? Group of answer choices Physical level X External level View level Logical level |
| What is an exception? Group of answer choices Problem in syntax Problem in IDE Problem arising during runtime Problem arising during compile time | What is an exception? Group of answer choices Problem in syntax Problem in IDE Problem arising during runtime// Problem arising during compile time |
| Which among the following is not a method of Throwable class? Group of answer choices public Throwable getCause() public String getMessage() public Char toString() public void printStackTrace() | Which among the following is not a method of Throwable class? Group of answer choices public Throwable getCause() public String getMessage() public Char toString() // public void printStackTrace() |
| Which of the following is correct? Group of answer choices All classes of Error extend from Exception. All classes of Exception extend from Error. All classes of Throwable extend from Exception All classes of Exception extend from Throwable. | Which of the following is correct? Group of answer choices All classes of Error extend from Exception. All classes of Exception extend from Error. All classes of Throwable extend from Exception All classes of Exception extend from Throwable. // |
| Encapsulation is supported by ___________ Group of answer choices None of the above Classes Methods Objects | Encapsulation is supported by ___________ Group of answer choices None of the above Classes // Methods Objects |
| If same message is passed to objects of several different classes and all of those can respond in a different way, what is this feature called? Group of answer choices Overloading Inheritance Overriding Polymorphism | If same message is passed to objects of several different classes and all of those can respond in a different way, what is this feature called? Group of answer choices Overloading Inheritance Overriding Polymorphism // |
| If a subclass reference is assigned to a superclass variable, the variable must be cast back to the subclass before any subclass methods can be called with it. Group of answer choices true false | If a subclass reference is assigned to a superclass variable, the variable must be cast back to the subclass before any subclass methods can be called with it. Group of answer choices true // false |
| What are the two types of Polymorphism? Group of answer choices Syntax and runtime derive and base Constructor and method encapsulation and Inheritance | What are the two types of Polymorphism? Group of answer choices Syntax and runtime X derive and base Constructor and method encapsulation and Inheritance |
| Abstraction can apply to ____________ Group of answer choices Control and data Only control Only data Classes | Abstraction can apply to ____________ Group of answer choices Control and data // Only control Only data Classes |
| Higher the level of abstraction, higher are the details. Group of answer choices True False | Higher the level of abstraction, higher are the details. Group of answer choices True False // |
| Using higher degree of abstraction __________ Group of answer choices May get unsafe May reduce readability Can increase vulnerability Can be safer | Using higher degree of abstraction __________ Group of answer choices May get unsafe May reduce readability Can increase vulnerability Can be safer // |
| Which of the following classes fail to compile? class X { } abstract class Y { } class Z { abstract void method(); } Group of answer choices X, Y, Z Y Z X | Which of the following classes fail to compile? class X { } abstract class Y { } class Z { abstract void method(); } Group of answer choices X, Y, Z Y Z // X |
| What is an exception? Group of answer choices Problem in syntax Problem in IDE Problem arising during runtime Problem arising during compile time | What is an exception? Group of answer choices Problem in syntax Problem in IDE Problem arising during runtime// Problem arising during compile time |
| Which among the following is not a method of Throwable class? Group of answer choices public Throwable getCause() public String getMessage() public Char toString() public void printStackTrace() | Which among the following is not a method of Throwable class? Group of answer choices public Throwable getCause() public String getMessage() public Char toString() // public void printStackTrace() |
| Which of the following is correct? Group of answer choices All classes of Error extend from Exception. All classes of Exception extend from Error. All classes of Throwable extend from Exception All classes of Exception extend from Throwable. | Which of the following is correct? Group of answer choices All classes of Error extend from Exception. All classes of Exception extend from Error. All classes of Throwable extend from Exception All classes of Exception extend from Throwable. // |
| Encapsulation is supported by ___________ Group of answer choices None of the above Classes Methods Objects | Encapsulation is supported by ___________ Group of answer choices None of the above Classes // Methods Objects |
| If same message is passed to objects of several different classes and all of those can respond in a different way, what is this feature called? Group of answer choices Overloading Inheritance Overriding Polymorphism | If same message is passed to objects of several different classes and all of those can respond in a different way, what is this feature called? Group of answer choices Overloading Inheritance Overriding Polymorphism // |
| If a subclass reference is assigned to a superclass variable, the variable must be cast back to the subclass before any subclass methods can be called with it. Group of answer choices true false | If a subclass reference is assigned to a superclass variable, the variable must be cast back to the subclass before any subclass methods can be called with it. Group of answer choices true // false |
| What are the two types of Polymorphism? Group of answer choices Syntax and runtime derive and base Constructor and method encapsulation and Inheritance | What are the two types of Polymorphism? Group of answer choices Syntax and runtime X derive and base Constructor and method encapsulation and Inheritance X |
| Abstraction can apply to ____________ Group of answer choices Control and data Only control Only data Classes | Abstraction can apply to ____________ Group of answer choices Control and data // Only control Only data Classes |
| Higher the level of abstraction, higher are the details. Group of answer choices True False | Higher the level of abstraction, higher are the details. Group of answer choices True False // |
| Using higher degree of abstraction __________ Group of answer choices May get unsafe May reduce readability Can increase vulnerability Can be safer | Using higher degree of abstraction __________ Group of answer choices May get unsafe May reduce readability Can increase vulnerability Can be safer // |
| Examine the following code: String str = "Hot Java"; boolean switch = str instanceof String; What value is placed in switch? Group of answer choices null true "Hot Java" false | Examine the following code: String str = "Hot Java"; boolean switch = str instanceof String; What value is placed in switch? Group of answer choices null true // "Hot Java" false |
| Abstraction principle includes___________ Group of answer choices Use abstraction whenever possible to achieve OOP Use abstraction at its minimum Use abstraction whenever possible to avoid duplication Use abstraction to avoid longer codes | Abstraction principle includes___________ Group of answer choices Use abstraction whenever possible to achieve OOP X Use abstraction at its minimum Use abstraction whenever possible to avoid duplication Use abstraction to avoid longer codes |
| What are two exception classes in hierarchy of java exceptions class? Group of answer choices Other exceptions Runtime exceptions and other exceptions Runtime exceptions only Compile time exceptions only | What are two exception classes in hierarchy of java exceptions class? Group of answer choices Other exceptions Runtime exceptions and other exceptions // Runtime exceptions only Compile time exceptions only |
| Which of these is a super class of all errors and exceptions in the Java language? Group of answer choices Catchable RunTimeExceptions None of the above Throwable | Which of these is a super class of all errors and exceptions in the Java language? Group of answer choices Catchable RunTimeExceptions None of the above Throwable // |
| What is the only type of exception that is NOT checked? Group of answer choices Class IOException and its subclasses. Class ArithmeticException only. Class RunTimeException and its subclasses. Class Exception. | What is the only type of exception that is NOT checked? Group of answer choices Class IOException and its subclasses. Class ArithmeticException only. Class RunTimeException and its subclasses. // Class Exception. |
| Program throws ___________ if assert statement fails. Group of answer choices java.lang.AssertError java.lang.AssertionError java.lang.AssertException java.lang.AssertionException | Program throws ___________ if assert statement fails. Group of answer choices java.lang.AssertError java.lang.AssertionError // java.lang.AssertException java.lang.AssertionException |
| Which type of function among the following shows polymorphism? Group of answer choices Virtual function Class member functions Undefined functions Inline function | Which type of function among the following shows polymorphism? Group of answer choices Virtual function // Class member functions Undefined functions Inline function |
| An abstract class cannot have instance data and non-abstract methods. Group of answer choices false true | An abstract class cannot have instance data and non-abstract methods. Group of answer choices false // true |
| If a class leaves one method in an interface undeclared, the class is implicitly declared by Java as an abstract class. Group of answer choices true false | If a class leaves one method in an interface undeclared, the class is implicitly declared by Java as an abstract class. Group of answer choices true false // |
| Encapsulation and abstraction differ as ____________ Group of answer choices Binding and Hiding respectively Hiding and hiding respectively Can be used any way Hiding and Binding respectively | Encapsulation and abstraction differ as ____________ Group of answer choices Binding and Hiding respectively // Hiding and hiding respectively Can be used any way Hiding and Binding respectively X |
| Which is the universal exception handler class? Group of answer choices Object Errors Math Exceptions | Which is the universal exception handler class? Group of answer choices Object X Errors Math Exceptions |
| If the Java program is using assertions, it must be run with -ea or -enableassertions switches. Group of answer choices True False | If the Java program is using assertions, it must be run with -ea or -enableassertions switches. Group of answer choices True False // |
| Which among the following can't be used for polymorphism? Group of answer choices Constructor overloading Static member functions Predefined operator overloading Member functions overloading | Which among the following can't be used for polymorphism? Group of answer choices Constructor overloading Static member functions // Predefined operator overloading Member functions overloading |
| What method of an Exception object returns a message string? Group of answer choices printMessage() getError() traceMessage() getMessage() | What method of an Exception object returns a message string? Group of answer choices printMessage() getError() traceMessage() getMessage() // |
| Why do we need to handle exceptions? Group of answer choices To prevent abnormal termination of program To encourage exception prone program To avoid syntax errors To save memory | Why do we need to handle exceptions? Group of answer choices To prevent abnormal termination of program // To encourage exception prone program To avoid syntax errors To save memory |