250
100.4k

610+ Java Programming Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Bachelor of Computer Applications (BCA) , Bachelor of Science in Computer Science (BSc CS) , Master of Computer Applications (MCA) , Programming Languages .

351.

Standard output variable ‘out’ is defined in which class?

A. Void
B. Process
C. Runtime
D. System
Answer» D. System
352.

Which of these packages contains all the event handling interfaces?

A. java.lang
B. java.awt
C. java.awt.event
D. java.event
Answer» C. java.awt.event
353.

Which of these keywords is not a part of exception handling?

A. try
B. finally
C. thrown
D. catch
Answer» C. thrown
354.

Which of these exceptions handles the divide by zero error?

A. ArithmeticException
B. MathException
C. IllegalAccessException
D. IllegarException
Answer» A. ArithmeticException
355.

Which of these exceptions will occur if we try to access the index of an array beyond its length?

A. ArithmeticException
B. ArrayException
C. ArrayIndexException
D. ArrayIndexOutOfBoundsException
Answer» D. ArrayIndexOutOfBoundsException
356.

What decides thread priority?

A. Process
B. Process scheduler
C. Thread
D. Thread scheduler
Answer» D. Thread scheduler
357.

Which of the following will ensure the thread will be in running state?

A. yield()
B. notify()
C. wait()
D. Thread.killThread()
Answer» C. wait()
358.

Which of these is used to read a string from the input stream?

A. get()
B. getLine()
C. read()
D. readLine()
Answer» C. read()
359.

Which of these methods can be used to output a string in an applet?

A. display()
B. print()
C. drawString()
D. tr
Answer» A. display()
360.

Which of these methods is a part of Abstract Window Toolkit (AWT) ?

A. display()
B. paint()
C. drawString()
D. tr
Answer» A. display()
361.

Which of these operators can be used to get run time information about an object?

A. getInfo
B. Info
C. instanceof
D. getinfoof
Answer» C. instanceof
362.

Which of these methods can be used to writing console output?

A. print()
B. println()
C. write()
D. all of the mentioned
Answer» D. all of the mentioned
363.

Which of these class is used to read from a file?

A. InputStream
B. BufferedInputStream
C. FileInputStream
D. BufferedFileInputStream
Answer» C. FileInputStream
364.

Which of these events is generated by scroll bar?

A. ActionEvent
B. KeyEvent
C. WindowEvent
D. AdjustmentEvent
Answer» D. AdjustmentEvent
365.

Which of these methods can be used to obtain the command name for invoking ActionEvent object?

A. getCommand()
B. getActionCommand()
C. getActionEvent()
D. getActionEventCommand()
Answer» B. getActionCommand()
366.

Which of the following is not a primitive data types?

A. Byte.
B. String.
C. Integer.
D. Float.
Answer» B. String.
367.

What is the range of the char type?

A. 0 to 216.
B. 0 to 215.
C. 0 to 216-1.
D. 0 to 215-1.
Answer» D. 0 to 215-1.
368.

Literals in java must be preceded by which of these?

A. L.
B. l.
C. D.
D. both a & b.
Answer» D. both a & b.
369.

Object is an _________ of a class.

A. instance.
B. implement.
C. inheritance.
D. invoke.
Answer» A. instance.
370.

Class is a ______ entity.

A. logical.
B. physical.
C. up normal.
D. collection of.
Answer» A. logical.
371.

Object is a _______ entity.

A. normal.
B. physical.
C. logical.
D. normal.
Answer» B. physical.
372.

______ can appear anywhere in the body of a java method.

A. definition.
B. declaration.
C. determine.
D. package.
Answer» B. declaration.
373.

______ must be the first non comment statement in the file.

A. package.
B. class.
C. object.
D. declaration.
Answer» A. package.
374.

_______ is passed to a method by use of call-by-reference.

A. variables.
B. objects.
C. methods.
D. operators.
Answer» B. objects.
375.

Every method of a ________ is implicitly final.

A. static class.
B. dynamic class.
C. final class.
D. abstract class.
Answer» C. final class.
376.

A _______ object cannot be modified after it is created.

A. double.
B. int.
C. string.
D. main.
Answer» C. string.
377.

A ____ class may not have any abstract method.

A. abstract.
B. static.
C. final.
D. public.
Answer» C. final.
378.

What will be the result of the expression 13 & 25?

A. 38.
B. 25.
C. 9.
D. 12.
Answer» C. 9.
379.

What will be result of expression 9 | 9?

A. 1.
B. 18.
C. 9.
D. 12.
Answer» C. 9.
380.

_________ Operators are overloaded for string objects?

A. -, +.
B. +, =.
C. <<, >>.
D. ++, --.
Answer» B. +, =.
381.

If an expression contains double, int, float, long, then whole expression will promoted into which of these data types?.

A. .long
B. int.
C. double.
D. float.
Answer» C. double.
382.

________ is valid for if statement?

A. An integer expression.
B. A Boolean expression.
C. A character expression.
D. A legal expression.
Answer» B. A Boolean expression.
383.

A package is a collection of ______.

A. keywords.
B. classes and interfaces.
C. editing tools.
D. views.
Answer» B. classes and interfaces.
384.

________ statement is valid for array declaration.

A. int number ();.
B. float number ();.
C. float number [];.
D. count Int [];.
Answer» C. float number [];.
385.

What is the output of relational operators?.

A. integer.
B. boolean.
C. character.
D. double.
Answer» B. boolean.
386.

Which of these operators can skip evaluating right hand operand?.

A. !.
B. |.
C. &.
D. &&.
Answer» D. &&.
387.

Which exception is thrown by the read () method of Input Stream class?

A. Exception.
B. ClassNotFoundException.
C. read Exception.
D. IOException.
Answer» D. IOException.
388.

Which of the following denotes a javadoc comment?

A. //#.
B. /*.
C. /**.
D. //**.
Answer» C. /**.
389.

Using the keyword interface you can fully abstract a _________.

A. method.
B. keyword
C. class.
D. variables.
Answer» C. class.
390.

One interface can inherit another by use of the keyword _____.

A. public.
B. extends.
C. method name.
D. class name.
Answer» B. extends.
391.

An exception is an __________ condition that arises in a code.

A. abnormal.
B. casual.
C. unfortunate.
D. opposite.
Answer» A. abnormal.
392.

______ is at the top of the exception class hierarchy.

A. try.
B. throwable.
C. exception class.
D. catch.
Answer» B. throwable.
393.

In java thread to thread communication is called _____.

A. passing.
B. sending.
C. messaging.
D. calling.
Answer» C. messaging.
394.

Which of these access specifiers can be used for an interface?.

A. public.
B. protected.
C. private.
D. All of the mentioned.
Answer» A. public.
395.

Java programs perform I/O through _______.

A. i/o methods.
B. i/o package.
C. streams.
D. compiler.
Answer» C. streams.
396.

In java a _______ is a sequence of characters.

A. string.
B. arrayChar.
C. groupChar.
D. collection.
Answer» A. string.
397.

The String is defined in _______ namespace.

A. java.Lang.
B. java.String.
C. java.Char.
D. java.Awt.
Answer» A. java.Lang.
398.

__________ is a special member function.

A. method.
B. class.
C. use defined function.
D. constructor.
Answer» D. constructor.
399.

Keyword _____ is always a reference to the object.

A. new.
B. this.
C. invoke.
D. class.
Answer» B. this.
400.

________ is the mechanism that binds together the code and the data.

A. polymorphism.
B. encapsulation.
C. inheritance.
D. together.
Answer» B. encapsulation.

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.