Time left:

[All Quizzes] → [Programming With Java] → [Object Oriented Concepts]


1. ► Which of following statement(s) can result in new object instance creation if executed successfully.

A.
B.
C.
D.
E.

2. ► Select correct option(s) about class Object.

A.
B.
C.
D.
E.

3. ► What would be correct output of following program?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class VQCourse {
    public String courseName;
    public int courseID;
} public class VirtuQCourseProvide {

    public static void main(String[]args) {
        VQCourse course1 = new VQCourse();
         course1.courseID = 0001;
         course1.courseName = "0001";

        VQCourse course2 = new VQCourse();
         course2 = course1;

         System.out.println("course1.courseID = " + course1.courseID +
                            ", course2.courseID = " + course2.courseID);
}}
A.
B.
C.
D.
E.

4. ► Class VQCourse contains declaration about a course, which is inside package com.vq . You are declaring a new class VirtuQCourseProvider where you want to create a object of VQCourse but following program fails to compile. Choose option which eliminates compilation error.

1
2
3
4
public class VirtuQCourseProvide {
    public static void main(String[]args) {
        VQCourse course1 = new VQCourse();
}}
A.
B.
C.
D.
E.

5. ► You only want to declare the behaviour of a certain type without any implemention , you should declare it as interface. In its most common form, an interface is a group of related methods with empty bodies.

1
2
3
4
5
6
7
8
9
package com.vq.inheritance;

public interface VQCourse {

    public void printCourseDetail();

    public void getCoursePrice();

}
A.
B.
C.

6. ► Following program have compilation error, can you guess root cause of it?

1
2
3
4
5
6
7
8
9
10
11
abstract class VQCourse {
    public String courseName;
    public String courseID;
} public class VirtuQCourseProvide extends VQCourse {

    public static void main(String[]args) {
        VQCourse course1 = new VQCourse();
         course1.courseID = "0001";
         course1.courseName = "JAVA";
         System.out.println(course1.toString());
}}
A.
B.
C.
D.
E.

7. ► Java provided mechanism where classes can inherit commonly used state and behaviour of other classes.

1
2
3
4
5
package com.vq.inheritance;

public class VQJavaCourse extends VQCourse {
//Some implementation 
}
A.
B.
C.

8. ► What is a object?

A.
B.
C.
D.
E.

9. ► Select correct statements about class(es).

A.
B.
C.
D.
E.

10. ► Which statement(s) is true about following program?

1
2
3
4
5
6
7
8
public class VirtuQCourseProvide {

    public static void main(String[]args) {
        String firstName = "VirtuQ";
        String lastName = "Simplifying Education";
        String FullName = firstName + lastName;
        String courseProvider = FullName;
}}
A.
B.
C.
D.
E.


© 2016 VirtuQ™ Education All right reserved. | Terms of Use | Privacy Policy