Untitled
Untitled
Untitled
False
Which constructor will be called from the object created in the below C++ code? class A {
int i; A() { i=0; cout<<i; } A(int x=0) { i=x; cout<<I; } }; A obj1;
If static data members have to be used inside a class, those member functions
Public
Thread
Which among the following is wrong syntax related to static data members?
class B extends A {}
private member
Methods
What is the output of the below Java code with an abstract class and inner class? public
abstract class AbstractClassTest6 { class Anonymous { int a=5; } public static void
main(String args[]) { System.out.print("Inner class is present.."); } }
If a class inheriting an abstract class does not define all of its function then it will be known
as?
Abstract
Which of these can be used to fully abstract a class from its implementation?
Interfaces
Which is the correct declaration to implement two interfaces?
class A implements B, C {}
Which among the following is correct for the class defined below?
Program runs and all objects are create
What is the output of the below Java program with an abstract class? abstract class
MathLibrary { static final float PI = 3.1415f; } public class AbstractClassTesting3 { public static
void main(String[] args) { System.out.println(MathLibrary.PI); } }
3.1415
java.lang
In which access should a constructor be defined, so that object of the class can be created in
any function?
Public
Code reusability
Which of these keywords is used to prevent content of a variable from being modified?
Final
When an overridden method is called from within a subclass, it will always refer to the
version of that method defined by the
Subclass
Which of the following is the correct way of implementing an interface salary by class
manager?
Which among the following is the correct syntax to access static data member without using
member function?
className :: staticDataMember;
Static
You read the following statement in a Java program that compiles and executes.
submarine.dive(depth); What can you say for sure?
No
Overloading <<
Private
Method declaration
TRUE
Private
main()
In object-oriented programming, the process by which one object acquires the properties of
another object is called
Inheritance
Single level inheritance is used, with both enclosing and nested classes
private Person()
{
age = 24;
}
}
public class Test
{
public static void main(String[] args)
{
Person p = new Person();
System.out.println(p.age);
}
}
Compilation error
Find the order of execution of constructors in Java Inheritance in the following bellow -
class Animal{
public Animal(){
System.out.println("Base Constructor");
}
}
class Cat extends Animal{
public Cat(){
System.out.println("Derived Constructor");
}
}
public class Program {
public static void main(String[] args) {
Cat c = new Cat();
}
}