Question 1
10 pts
Java does not support                                  .
Group of answer choices
Interface
Method Overriding
Multiple inheritance for classes
Polymorphism
 
Flag question: Question 2
Question 2
10 pts
Variables, methods, and constructors, which are declared protected in a superclass can be accessed only by the subclasses in other packages or any class within the package of the protected members' class.
Group of answer choices
True
False
 
Flag question: Question 3
Question 3
10 pts
What is Truncation for numeric variables in Java?
Group of answer choices
Floating-point value assigned to an Floating type
None of the Mentioned
Integer value assigned to ﬂoating type
Floating-point value assigned to an integer type
 
Flag question: Question 4
Question 4
10 pts
Which of these is an invalid Array declaration?
Group of answer choices
int[] arr = new int[];
int[] arr; arr = new int[5];
int[] arr = new int[5];
None of the mentioned
 
Flag question: Question 5
Question 5
10 pts
What is Polymorphism In object-oriented programing?
Group of answer choices
Process of hiding the implementation details from the user, only the functionality will be provided to the user. In other words, the user will have the information on what the object does instead of how it does it.
An ability by which one class acquires the properties and behaviors of another class
A process that binds together the data and functions that manipulate the data and that keeps both safe from outside interference and misuse.
Refers to the ability of a variable, function or object to take on multiple forms
 
Flag question: Question 6
Question 6
10 pts
Which of these statements is incorrect?
Group of answer choices
Interfaces cannot have constructors.
Abstrac classes can have constructors.
Interfaces can be instantiated
Abstract classes may or may not have abstract methods.
 
Flag question: Question 7
Question 7
10 pts
Which of the following modiﬁer means a particular variable cannot be accessed from other class even within the same package?
Group of answer choices
default
protected
public
private
 
Flag question: Question 8
Question 8
10 pts
What is Autoboxing?
Group of answer choices
when an object of a wrapper class is automatically converted to its matching primitive value
A mechanism of Abstraction
A mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit
when a primitive value is automatically converted to its matching wrapper class object
 
Flag question: Question 9
Question 9
10 pts
If a class of a Java program has a plural number of methods, and all of them have the same name but diﬀerent parameters (with a change in type or number of arguments), then it is known as method overloading.
Group of answer choices
True
False
 
Flag question: Question 10
Question 10
10 pts
Which of the following best describes the meaning of static?
Group of answer choices
The static keyword can be applied to local variables. This implies that their values persist between calls to the method that declares the variable.
The static keyword can be applied to class members. This implies that the class members (static ones) belong to the class, not to instances of the class.
The static keyword, when applied to ﬁelds, means that the ﬁeld can only be accessed through instances of the class.
When applied to a class, the static keyword implies that instances of the class are immutable.
 
Flag question: Question 11
Question 11
10 pts
How many copies of static (class) variables and instance variables are created when 10 objects are created of a class?
Group of answer choices
1,1
10, 10
1, 10
10,1
 
Flag question: Question 12
Question 12
10 pts
Which of the following is a valid declaration of an object of class Box?
Group of answer choices
Box obj = new Box;
obj = new Box();
Box obj = new Box();
Box new obj;
 
Flag question: Question 13
Question 13
10 pts
Which one is a valid declaration of a boolean?
Group of answer choices
boolean b4 = True;
boolean b1 = 1;
boolean b2 = False;
boolean b3 = false;
 
Flag question: Question 14
Question 14
10 pts
Which of the below is an invalid identiﬁer with the main() method?
Group of answer choices
public
private
final
static
 
Flag question: Question 15
Question 15
10 pts
In Java, what is the difference between the String Class and the StringBuffer Class?
Group of answer choices
No diﬀerence, the two classes are equivalent.
StringBuﬀer is the parent/super case of String.
A String is immutable, if you try to alter its value, another object gets created. A StringBuﬀer is mutable so it can change its value.
A StringBuﬀer is immutable, if you try to alter its value, another object gets created. A String is mutable so it can change its value.
 
Flag question: Question 16
Question 16
10 pts
What data type would you use to store the names of students?
Group of answer choices
String
char
boolean
int
 
Flag question: Question 17
Question 17
10 pts
A method declaration has  (check all that are correct):
Group of answer choices
Parentheses () - with or without a parameter list.
An optional access speciﬁer which, if not present, defaults to package access.
A return-type, or void if no value is returned.
At least one parameter
A name
 
Flag question: Question 18
Question 18
10 pts
What is the output of the following Java program? Please assume all classes are in the same package.

class A {
    String E = "extraction ";
    String T = "transformation ";
    String L = "loading ";
    final void ETL() {
        System.out.println(L + T + E);
    };
}
class B extends A {
    void ETL() {
        System.out.println(E + T + L);
    }
}
public class Main {
    public static void main(String args[]) {
        A obj = new B();
        obj.ETL();
    }
}
Group of answer choices
Runtime error
Compile time error
extraction transformation loading
loading transformation extraction
None of the mentioned
 
Flag question: Question 19
Question 19
10 pts
Which keyword(s) can be part of a class declaration? (check all that are correct)
Group of answer choices
class
extend
extends
switch
implements
 
Flag question: Question 20
Question 20
10 pts
What is the return type of Constructors?...
Group of answer choices
void
No explicit return type
float
int
 
Flag question: Question 21
Question 21
10 pts
What is the output of the following Java program?

 
public class Jump_statments {
    public static void main(String args[]) {
        int x = 2;
        int y = 0;
        for (; y < 10; ++y) {
            if (y % x == 0)
                continue;
            else if (y == 8)
                break;
            else
                System.out.print(y + " ");
        }
    }
}
Group of answer choices
2 4 6 8
1 3 5 7
1 3 5 7 9
1 2 3 4 5 6 7 8 9
 
Flag question: Question 22
Question 22
10 pts
Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?
Group of answer choices
for
while
None of the above
do-while
 
Flag question: Question 23
Question 23
10 pts
What is the output of the following Java program? Please assume all classes are in the same package.

class A {
    public String[] getSdlc() {
        return sdlc;
    }

    String sdlc[] = {
            "requirement analysis",
            "design",
            "development",
            "testing",
            "implementation",
            "maintenance"
    };
}
class B extends A {
    public String[] getSdlc() {
        return sdlc;
    }

    private String sdlc[] = {
            "r","d","d","t","i","m"
    };
}
class C extends B {
    public String[] getSdlc() {
        return sdlc;
    }

    String sdlc[] = {
            "s","d","l","c"
    };
}
public class Main {
    public static void main(String args[]) {
        B obj = new C();
        for (int i = 0; i < obj.getSdlc().length;
             i++) {
            System.out.print(obj.getSdlc()[i] + "");
        }
    }
}
Group of answer choices
Compile time error
sdlc
rddtim
requirement analysis design development testing implementation maintenance
Runtime error
 
Flag question: Question 24
Question 24
10 pts
What is the extension of Java source code ﬁles?
Group of answer choices
.jar
.java
.class
.jv
 
Flag question: Question 25
Question 25
10 pts
What is Inheritance in Object-Oriented Programming?
Group of answer choices
A process that binds together the data and functions that manipulate the data and that keeps both safe from outside interference and misuse.
An ability by which one class acquires the properties and behaviors of another class
Process of hiding the implementation details from the user, only the functionality will be provided to the user. In other words, the user will have the information on what the object does instead of how it does it.
Refers to the ability of a variable, function or object to take on multiple forms
 
Flag question: Question 26
Question 26
10 pts
What is the process of deﬁning more than one method in a class diﬀerentiated by method signature?
Group of answer choices
Method Overlapping
Method Overloading
Method Overwriting
Method Overriding
 
Flag question: Question 27
Question 27
10 pts
IS-A relationship in Java is related to -
Group of answer choices
None of the mentioned
Inheritance
Encapsulation
Composition
 
Flag question: Question 28
Question 28
10 pts
What is the output of the following Java program? Please assume all classes are in the same package.

class A {
    void ETL() {
        String E = "mySQL";
        String T = "Sqoop";
        String L = "hdfs";
        System.out.println(E + T + L);
    };
    void ETL(String ETL) {
        System.out.println(ETL.toUpperCase());
    }
    void ETL(String E, String T, String L) {
        System.out.println(E + T + L);
    }
}
public class Main {
    public static void main(String args[]) {
        String E = "extraction1";
        String T = "transformation2";
        String L = "loading3";
        A obj = new A();
        obj.ETL(E + T + L);
    }
}
Group of answer choices
mySQLSqoophdfs
EXTRACTION1 TRANSFORMATION2 LOADING3
extraction1transformation2loading3
EXTRACTION1TRANSFORMATION2LOADING3
 
Flag question: Question 29
Question 29
10 pts
What is the output of the following program? Assume that each class is correctly declared in its own file and that the main method of Chemistry is the JVM entry point. Please assume all classes are in the same package.

 
public class Element {
    public String appearance() {
        return "OVERRIDE THIS METHOD";
    }
}
public class Iodine extends Element {
    @Override public String appearance() {
        return "lustrous, purple-black non- metallic solid";
    }
}
public class Chemistry {
    public static void main(String[] args) {
        Element e = new Iodine();
        System.out.println(e.appearance());
    }
}
 
 
Group of answer choices
OVERRIDE THIS METHOD
OVERRIDE THIS METHOD lustrous, purple-black non-metallic solid
The program will not compile because Iodine is not an Element.
lustrous, purple-black non-metallic solid
 
Flag question: Question 30
Question 30
10 pts
Given these code snippets:

 
public abstract class Mineral {
    // define abstract methods for origin, hardness and appearance.
}
public class Diamond extends Mineral {
    // implement origin, hardness and appearance methods.
}
 
Is the following assignment valid?
Diamond d = new Mineral();

 
Group of answer choices
NO
YES