NEW
Font size
WorksheetsBASIC JAVA
Total questions: 50
Worksheet time: 25mins
Which Scanner class method that closes the scanner?
void remove()
void close()
nextLong()
String next()
Which Scanner class method that resets the scanner?
nextFloat()
int radix()
Scanner skip(String pattern)
short nextShort()
Which Scanner class method is used to read th Integer value from the user?
next()
nextInteger()
nextInt()
readInt()
Which Scanner class method is used to read long value from the user?
long()
nextLong()
nextValue()
none of the choices
Which Scanner class method is used to read string value from the user?
next()
nextString()
nextLine()
none of the choices
Which Scanner class method is used to read boolean value from the user?
next()
readBoolean()
nextBoolean()
none of the choices
Which Scanner class method is used to read double value from the user?
next()
readDouble()
nextDouble()
none of the choices
Which Scanner class method is used to read short value from the user?
next()
readShort()
nextShort()
none of the choices
Which Scanner class method is used to read byte value from the user?
next()
readByte()
nextByte()
none of the choices
It is used to store a collection of data?
string
array
variables
syntax
Which of the following is the correct syntax of ARRAY?
dataType [] arrayRefVar;
dataType [] array;
dataType [array];
dataType [arrayRefVar];
Which of the following String Class method that can use to compares this String to another object?
char charAt(int index)
int compareTo(String anotherString)
String concat(String str)
int compareTo(Object o)
Which of the following String Class method that can concatenates the specified string to the end of this string?
int compareTo(Object o)
char charAt(int index)
String concat(String str)
boolean endsWith(String suffix)
Which of the following String Class method that can compares this string to the specified object?
Boolean equals(Object anObject)
boolean endsWith(String suffix)
boolean endsWith(String suffix)
boolean endsWith(String suffix)
Which of the following String Class method that returns a String that represents the character sequence in the array
specified?
String concat(String str)
int compareTo(Object o)
char charAt(int index)
static String copyValueOf(char[] data)
Which of the following Array Class method that searches the specified array of Object?
public static int binarySearch(Object[] a, Object key)
public static boolean equals(long[] a, long[] a2)
public static void fill(int[] a, int val)
public static void sort(Object[] a)
Which of the following Array Class method that returns true if the two specified arrays of longs are equal to one
another?
public static int binarySearch(Object[] a, Object key)
public static boolean equals(long[] a, long[] a2)
public static void fill(int[] a, int val)
public static void sort(Object[] a)
Which of the following Array Class method that assigns the specified int value to each element of the specified array
of ints?
public static int binarySearch(Object[] a, Object key)
public static boolean equals(long[] a, long[] a2)
public static void fill(int[] a, int val)
public static void sort(Object[] a)
Which of the following Array Class method that sorts the specified array of objects into an ascending order,
according to the natural ordering of its elements?
public static int binarySearch(Object[] a, Object key)
public static boolean equals(long[] a, long[] a2)
public static void fill(int[] a, int val)
public static void sort(Object[] a)
What will be the output of this program?
Got the Exception 10
Got the Exception 0
Compiler Error
Got the Exception 11
What will be the output of this program?
Got the Exception 10
Got the Exception 0
Compiler Error
Got the Exception 11
What will be the output of this program?
Got the Test Exception Inside finally block
Got the Test Exception
Inside finally block
Compiler Error
What will be the output of this program?
Compiler Error
Compiles and runs fine
Compiles fine but throws
ArithmeticException exception
No output
What will be the output of this program?
Caught base class exception
Caught derived class exception
Compiler Error because derived is not
throwable
Compiler Error because base class
exception is caught before derived class
These are not exceptions at all, but problems that arise beyond the control of the user or the programmer?
Unchecked exceptions
Checked exceptions
Throwable
Error
It is an exception that occurs at the time of execution?
Throwable
Checked exceptions
Unchecked exceptions
Error
It is an exception that is checked (notified) by the compiler at compilation-time, these are also called as compile
time exceptions?
Checked exceptions
Throwable
Unchecked exceptions
Error
It returns a detailed message about the exception that has occurred. This message is initialized in the Throwable
constructor?
public Throwable getCause()
public String getMessage()
public void printStackTrace()
public String toString()
It returns the cause of the exception as represented by a Throwable object?
public String getMessage()
public Throwable getCause()
public void printStackTrace()
public String toString()
Which exception is raised when a method could not convert a string into a numeric format?
ArithmeticException
NumberFormatException
IOException
ClassNotFoundException
It is thrown when a class does not contain the field (or variable) specified?
NoSuchFieldException
NumberFormatException
IOException
ClassNotFoundException
It is thrown when accessing a method which is not found?
NoSuchFieldException
NumberFormatException
NoSuchMethodException
ClassNotFoundException
Which exception is raised when referring to the members of a null object?
NoSuchFieldException
NumberFormatException
NoSuchMethodException
NullPointerException
Which exception is raised when a file is not accessible or does not open?
NoSuchFieldException
FileNotFoundException
NoSuchMethodException
NullPointerException
It is thrown when an input-output operation failed or interrupted?
NoSuchFieldException
FileNotFoundException
IOException
NullPointerException
It is thrown when a thread is waiting , sleeping , or doing some processing , and it is interrupted?
NoSuchFieldException
InterruptedException
IOException
NullPointerException
It is thrown when an exceptional condition has occurred in an arithmetic operation?
NoSuchFieldException
InterruptedException
IOException
ArithmeticException
It is thrown to indicate that an array has been accessed with an illegal index?
ArrayIndexOutOfBoundsException
InterruptedException
IOException
ArithmeticException
Which exception is raised when we try to access a class whose definition is not found?
ArrayIndexOutOfBoundsException
InterruptedException
ClassNotFoundException
ArithmeticException
It is a mechanism where you bind your data and code together as a single unit?
Interface
Inheritance
Abstraction
Encapsulation
When the Java Project is initiated?
June 1937
June 1991
June 1946
June 1976
They named ______ after that tree stood outside Gosling’s office.
Tea
Tree
Oak
OOP
It is the OOP concept for inheriting class?
Encapsulation
Interface
Inheritance
Abstraction
Who is the founder of JAVA creation?
James Gosling
John Gosling
Jawhead Gosling
Luke Gosling
This operator “()” also known as?
Parenthesis
Braces
Brackets
Semicolon
This operator “.”also known as?
Colons
Comma
Period
d. Braces
This operator ”::” also known as?
Semicolons
Braces
Parenthesis
Colons
This operator “{}” also known as?
Period
Brackets
Parenthesis
Braces
What is the name of this operator “[]“?
Brackets
Comma
Semicolons
Period
