Java Programming mcq and answer
What is Java Programming?
java programming mcq questions and answers pdf free download. Java is a programming language and a platform. Java is a high level, robust, object-oriented and secure programming language. Java was developed by Sun Micro systems (which is now the subsidiary of Oracle) in the year 1995. James Gosling is known as the father of Java. Before Java, its name was Oak. Since Oak was already a registered company, so James Gosling and his team changed the name from Oak to Java.
Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. -Wikipedia
Java Programming mcq and answer :-
1)Which of the following is a valid declaration of a char? ?
A. char ch = ‘\utea’;
B. char ca = ‘tea’;
C. char cr = \u0223;
D. char cc = ‘\itea’;
Ans:C
2)Which package contains the Random class?
A. java.util package
B. java.lang package
C.java.awt package
D. java.io package
Ans: A
3)Which of the given methods are of Object class?
A. notify(), wait( long msecs ), and synchronized()
B. notify(), notifyAll(), and wait()
C. sleep( long msecs ), wait(), and notify()
D. wait( long msecs ), interrupt(), and notifyAll()
Ans: C
4) If three threads trying to share a single object at the same time, which condition will arise in this scenario??
A. Time-Lapse
B. Critical situation
C. Race condition
D. Recursion
Ans: C
5) What are the Type Conversions available in Java language? ?
A. Narrowing Type Conversion
B. Widening Type Conversion
C.A and B
D. None of the above
Ans: C
Java Programming Objective type Questions with Answers
6) What is a Narrowing Type Conversion in Java? ?
A. Conversion of data from lower data type to higher data type
B. Conversion data from a higher data type to a lower data type
C. Conversion of data from any data type to any data type
D. None of the above
Ans: B
7) An Arithmetic expression in Java involves which Operators or Operations?
A. Addition (+), Subtraction (-)
B. Multiplication (*), Division (/)
C. Modulo Division (%), Increment/Decrement (++/–), Unary Minus (-), Unary Plus (+)
D. All the above
Ans: D
8) What are the types of data that can be used along with Relational operators in Java?
A. char, boolean, Object
B. byte, short, int, long
C. float, double
D. All the above
Ans: D
9)What is the output of a Logical OR (|) operation if one of the inputs/operands is false?
A. false
B. true
C. true or false
D. None of the above
Ans:C
10) Which is fast among OR(|) and Short Circuit OR (||) operators in Java? ?
A. OR Operator
B. Short Circuit OR operator
C. Both work at the same speed
D. None of the above
Ans:B