Menu

Objective Type Questions & Answers


Object Oriented Programming through Java MCQs - Unit-1



1. Which provides runtime environment for java byte code to be executed?

A . JDK

B . JVM

C . JRE

D . JAVAC

Answer



2. Which variables are created when an object is created with the use of the keyword `new` and destroyed when the object is destroyed?

A . Local variables

B . Instance variables

C . Class Variables

D . Static variables

Answer



3. Choose a Single Line Comment in Java Language below?

A . //Some comments

B . Some comments//

C . /*Some comments*/

D . */Some comments/*

Answer



4. A valid identifier in Java language may contain which characters?

A . 0-9

B . A-Z, a-z

C . $, _ (Underscore)

D . All the above

Answer



5. In Java, Multi-line comments are represented by _____________

A . //

B . /* */

C . /# #/

D . */ */

Answer



6. The Primitive data types in java are ____________________

A . Pre-defined data types

B . User-defined data types

C . Both

D . None of the above

Answer



7. Which of the following expression is an invalid?

A . int Abc = 12;

B . String full_name = "yourname";

C . float 4d = 12.3f;

D . double d$ = 1234.456d;

Answer



8. In java, The instance variable is declared ____________________.

A . inside the method

B . inside class but outside the method

C . inside class but outside the method and it is static

D . outside the class

Answer



9. A data type is converted into another data type by the programmer is known as ____________?

A . Type Conversion

B . Implicit conversion

C . Type Casting

D . None of the above

Answer



10. Which one is true about a constructor ?

A . A constructor must have the same name as the class it is declared within.

B . A constructor is used to Initialize the objects.

C . A constructor may be declared private

D . All of the above

Answer



11. What are the keywords used to implement a SWITCH case in Java language?

A . switch, case

B . default

C . break

D . All

Answer



12. Which of the following statement is invalid?

A . break - immediately jumps to end of the loop

B . continue - immediately jumps to next interation

C . while loop - if the number of iterations are not fixed

D . for loop - if the number of iterations are not fixed

Answer



13. Which of the following array declaration is invalid?

A . Datatype array_name[] = new DataType[size];

B . Datatype[] array_name = new DataType[size];

C . Datatype array_name[] = {val1,val2,val3,......valn};

D . Datatype array_name[] = new DataType[];

Answer



14. Do you want to access the data members of a class, you have to create ___________?

A . an object

B . a variable

C . a method

D . an array

Answer



15. In java,  the String class is comes under ___________ package?

A . java.io

B . java.lang

C . java.util

D . java.String

Answer



16. In java,  the System class is comes under ___________ package?

A . java.io

B . java.lang

C . java.util

D . java.String

Answer



17. In java,  the Scanner class is comes under ___________ package?

A . java.io

B . java.lang

C . java.util

D . java.String

Answer



18. In java,  the Console class is comes under ___________ package?

A . java.io

B . java.lang

C . java.util

D . java.String

Answer



19. Which of these is an incorrect Statement?

A . It is necessary to use new operator to initialize an array

B . Array can be initialized using comma separated expressions surrounded by curly braces

C . Array can be initialized when they are declared

D . None of the mentioned

Answer



20. In a .java file, how many numbers of public types namely class, interface or abstract can be managed?

A . 1

B . 2

C . 3

D . Any number

Answer



21. Java method overloading implements the OOPS concept ___.

A . Inheritance

B . Polymorphism

C . Encapsulation

D . None

Answer



Fill in the Blanks


22. To successfully overload a method in Java, the argument-list or parameter-list must be ___.(Same/Different)

Answer


23. A local variable declared inside a method can not be used in expressions without initializing it first.(TRUE / FALSE).

Answer


24. In Java, an array can be declared without initialization without mentioning the size.(True / False)

Answer


25. State TRUE or FALSE. An ELSE or ELSE-IF statement in Java can not exist alone without IF statement.(FALSE /TRUE).

Answer




Relevant Materials :

Object Oriented Programming through Java MCQs - Unit-1 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-2 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-3 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-4 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-5 - [ OOP_JAVA ]


Similar Materials :

R - Programming MCQs - Unit-1 - [ R-Programming ]

R - Programming MCQs - Unit-2 - [ R-Programming ]

R - Programming MCQs - Unit-3 - [ R-Programming ]

R - Programming MCQs - Unit-4 - [ R-Programming ]

R - Programming MCQs - Unit-5 - [ R-Programming ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-1 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-2 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-3 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-4 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-5 - [ FLAT ]

PPS MCQs - Unit-1 - [ PPS ]

PPS MCQs - Unit-2 - [ PPS ]

PPS MCQs - Unit-3 - [ PPS ]

PPS MCQs - Unit-4 - [ PPS ]

PPS MCQs - Unit-5 - [ PPS ]

Design and Analysis of Algorithms MCQs - Unit-1 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-2 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-3 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-4 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-5 - [ DAA ]

Software Engineering MCQs - Unit-1 - [ SE ]

Software Engineering MCQs - Unit-2 - [ SE ]

Software Engineering MCQs - Unit-3 - [ SE ]

Software Engineering MCQs - Unit-4 - [ SE ]

Software Engineering MCQs - Unit-5 - [ SE ]

Data Mining MCQs - Unit-1 - [ DM ]

Data Mining MCQs - Unit-2 - [ DM ]

Data Mining MCQs - Unit-3 - [ DM ]

Data Mining MCQs - Unit-4 - [ DM ]

Data Mining MCQs - Unit-5 - [ DM ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-1 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-2 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-3 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-4 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-5 - [ COA ]

Data Structures Objective Type Question Bank-Unit-1 - [ DS ]

Data Structures Objective Type Question Bank-Unit-2 - [ DS ]

Data Structures Objective Type Question Bank-Unit-3 - [ DS ]

Data Structures Objective Type Question Bank-Unit-4 - [ DS ]

Data Structures Objective Type Question Bank-Unit-5 - [ DS ]

Database Management System Objective Type Question Bank-Unit-1 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-2 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-3 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-4 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-5 - [ DBMS ]

Cyber Forensics Objective Type Question Bank-Part-2 - [ Cyber Forensics ]

Cyber Forensics Objective Type Question Bank-Part-1 - [ Cyber Forensics ]

Java Programming Objective Type Question Bank - [ Java Programming ]

Java Programming Objective Type Questions-Part-1 - [ Java Programming ]

Java Programming Objective Type Questions-Part-2 - [ Java Programming ]