JNDI/JNDI MCQ QUESTIONS AND ANSWER Sample Test,Sample questions

Question:
 Can the Java program accept input from the command line?

1.Yes, using command-line arguments

2.Yes, by access command prompt

3.No

4.None of these


Question:
 What is stringBuffer in java?

1.Class to create a string array

2.Class to create a mutable string in java

3.Class to create a string from i/o buffer

4.All of these


Question:
'this' keyword in java is ___.

1.Used to hold the reference of the current object

2.Holds object value

3.Used to create a new instance

4.All of these


Question:
Abstract class is ___.

1.Created using abstract keyword

2.Contains only abstract method

3.Needs to be inherited to be used

4.All of these


Question:
Array in java is ___.

1.Collection of similar elements

2.Collection of elements of different types

3.The data type of consisting of characters

4.None of these


Question:
BigInteger Class is used to ___.

1.Store very long range of number

2.Store integer values

3.A class that stores large range of integer

4.All of these


Question:
Boxing is ___.

1.Creating new box

2.Creating object

3.Converting primitive type of object instance

4.All of these


Question:
Can we keep a different name for the java class name and java file name?

1.Yes

2.No


Question:
Can we write a program without a main method in Java?

1.Yes

2.No


Question:
Encapsulation is ___.

1.Wrapping up of data and related functions into a single entity

2.Creating special methods

3.Creating special data structure

4.All of these


Question:
Finally block is attached to?

1.Try-catch block

2.Class block

3.Method block

4.All of these


Question:
How can we access methods for file handling in java?

1.Java.files

2.Java.io

3.Java.io.File

4.Java.FileHandling


Question:
In java, recursion is ___.

1.Method

2.A process allowing methods to call itself

3.The process to call methods

4.None of these


Question:
Is string mutable in Java?

1.Yes

2.No


Question:
JDK stands for ____.

1.Java development kit

2.Java deployment kit

3.Java deployment kit

4.None of these


Question:
JRE stands for ___.

1.Java run ecosystem

2.JDK runtime Environment

3.Java Runtime Environment

4.None of these


Question:
Method used to take a string as input in Java?

1.next()

2.nextLine()

3.Both A. and B

4.None of these


Question:
Multiline comment is created using ___.

1.//

2./* */

3.<!-- -- >

4.All of these


Question:
Object in java are ___.

1.Classes

2.References

3.Iterators

4.None of these


Question:
Static variables in java are declared as ___.

1.final variables

2.new variables

3.Constants

4.All of these


Question:
The 'super' keyword is used to ___.

1.Access instance of the parent class

2.Access instance of the same class

3.Access instance of child class

4.Access instance of friend class


Question:
The break statement in Java is used to ___.

1.Terminates from the loop immediately

2.Terminates from the program immediately

3.Skips the current iteration

4.All of these


Question:
The correct syntax to import the math library in java is ___.

1.import java.lang.math

2.import math

3.import java.math

4.All of these


Question:
The super() method is used to ___.

1.Call constructor of friend class

2.Is a declared method

3.Call constructor of the parent class

4.Call constructor


Question:
What are the types of memory allocated in memory in java?

1.Heap memory

2.Stack memory

3.Both A and B

4.None of these


Question:
What is a comparator in Java?

1.Interface to compare integer

2.Comparison method for lists

3.Interface to compare two objects in java

4.All of these


Question:
What is a comparator in Java?

1.Interface to compare integer

2.Comparison method for lists

3.Interface to compare two objects in java

4.All of these


Question:
What is file handling in java?

1.It is creating, deleting, and modifying files using a java program.

2.Creating new method

3.Filing method to different file to extract them better

4.All of these


Question:
What is garbage collection in java?

1.Method to manage memory in java

2.Create new garbage values

3.Delete all values

4.All of these


Question:
What is the entry point of a program in Java?

1.main() method

2.The first line of code

3.Last line of code

4.main class


Question:
What is type casting in Java?

1.It is converting type of a variable from one type to another

2.Casting variable to the class

3.Creating a new variable

4.All of these


Question:
What makes the Java platform independent?

1.Advanced programming language

2.It uses bytecode for execution

3.Class compilation

4.All of these


Question:
Which class in Java is used to take input from the user?

1.Scanner

2.Input

3.Applier

4.None of these


Question:
Which is the correct absolute path of a file in Java?

1.C:Program FilesJavajdk1.8.0_131infile_name.txt

2.C:Program FilesJavafile_name.txt

3.C:Program FilesJavajdk1.8.0_131file_name.txt

4.C:Program FilesJavajdk1.8.0_131inFile Handlingfile_name.txt


Question:
Which is/are valid method(s) of math library in java?

1.max()

2.cbrt()

3.log10()

4.All of these


Question:
Which Java method is used to convert an object to string?

1.createString()

2.toString()

3.object.string()

4.newString()


Question:
Which keyword in java is used for exception handling?

1.exep

2.excepHand

3.throw

4.All of these


Question:
Which method in java is used to generate random numbers in Java?

1.random.nextInt()

2.random()

3.rand()

4.All of these


Question:
Which method in java is used to read lines from file?

1.file.read()

2.file.nextLine()

3.file.getLine()

4.All of these


Question:
Which method is used to add a new line to file in Java?

1.file.addLine()

2.file.nextLine()

3.file.write()

4.file.line()


Question:
Which of the following can be declared as final in java?

1.Class

2.Method

3.Variable

4.All of these


Question:
Which of the following is a valid data structure in java?

1.Array

2.List

3.Vector

4.All of these


Question:
Which of the following is the correct syntax to create a variable in Java?

1.var name;

2.int name;

3.var name int;

4.All of these


Question:
Which of the following methods are present in comparator interface?

1.compare()

2.equate()

3.isEqual()

4.All of these


Question:
Which of these is a type of variable in Java?

1.Instance Variable

2.Local Variable

3.Static Variable

4.All of these


Question:
Which of these is the correct method to create an array in java?

1.int[] arr = {1, 3, 5};

2.nt[] arr;

3.int arr[] = {1, 4, 6};

4.All of these


Question:
Which of these is true for interfaces in java?

1.The keyword interface is used to create a method

2.All the methods of an interface are abstract

3.It does not contain constructors

4.All of these


Question:
Which syntax is valid to create a vector in java?

1.Vector < string > names = new Vector < String > ();

2.Vector name = new string;

3.int name = new vector ()

4.All of these


Question:
Which type of casting is lossy in Java?

1.Widening typecasting

2.Narrowing typecasting

3.Manual typecasting

4.All of these


Question:
Wrapper class in java is ___.

1.Used to encapsulate primitive data types

2.Declare new classes called wrapper

3.Create a new instance of the class

4.None of these


More MCQS

  1. JNDI MCQ QUESTIONS AND ANSWER
  2. JNDI MCQ QUESTIONS AND ANSWER
  3. JNDI MCQ QUESTIONS AND ANSWER
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!