0% found this document useful (0 votes)
101 views

Java Programming Set 1

James Gosling is considered the creator of Java. The document discusses Java programming multiple choice questions and answers related to Java fundamentals like data types, operators, loops, arrays and more. It provides 25 questions with explanations of the answers to help test knowledge of Java programming concepts.

Uploaded by

Magarsaa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views

Java Programming Set 1

James Gosling is considered the creator of Java. The document discusses Java programming multiple choice questions and answers related to Java fundamentals like data types, operators, loops, arrays and more. It provides 25 questions with explanations of the answers to help test knowledge of Java programming concepts.

Uploaded by

Magarsaa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Java Programming MCQs [set-1]

1. Who is considered as the creator of JAVA ?


A. Dennis Richie
B. Ken Thompson
C. James Gosling
D. Bjarne Stroupstrup
Answer: C

2. Which of the following statements about the Java language is true?


A. Java supports only Procedural Oriented Programming approach

o m
B. Both Procedural and Object Oriented Programming are supported in Java
C. Java supports only Object Oriented Programming approach
D. None of the Above . c
Answer: C
te
a
3. JRE stands for
q M
A. Java Realtime Environment
c
B. Java Rapid Enterprise
C. Java Runtime Environment
M
D. None of the above
Answer: C

4. Java source files are compiled and converted to


A. Object code
B. machine code
C. Bytecode
D. executable file
Answer: C

5. JVM is ___________for bytecode.


A. a compiler
B. an interpreter
C. assembler
D. none of the above
Answer: B

6. What is the size of int data type in java?


A. 1 bytes
B. 2 bytes
C. 4 bytes
D. 8 bytes
Answer: C

7. Which is a valid float literal?


A. 1.23
B. 2
C. 1.23d
D. 1.23f
Answer: D

8. What is the numerical range of a char in Java?


A. -128 to 127
B. 0 to 256
C. 0 to 32767
D. 0 to 65535
Answer: D

9. Which of these coding types is used for data type char in Java?
A. ASCII
B. ISO-LATIN-1
C. UNICODE
D. None of the mentioned
Answer: C

10. Which of these values can a boolean variable contain?


A. True & False
B. 0 & 1
C. Any integer value.
D. Both a & b
Answer: A

View all MCQ's at McqMate.com


11. Which one of the following is a valid identifier in java?
A. x1
B. 1x
C. $x
D. x 1
Answer: A

12. Which operator is used to implement unsigned right shift of an integer?


A. <<
B. >>
C. <<<
D. >>>
Answer: D

13. Which one of the following is a jump statement in java?


A. goto
B. jump
C. break
D. if
Answer: C

14. Which of these operators is used to allocate memory to array variable in Java?
A. malloc
B. alloc
C. new
D. new malloc
Answer: C

15. Which of the following loops will execute the body of loop even when condition
controlling the loop is initially false?
A. do-while
B. while
C. for
D. None of the mentioned
Answer: A

16. Which of these is necessary condition for automatic type conversion in Java?

View all MCQ's at McqMate.com


A. The destination type is smaller than source type.
B. The destination type is larger than source type.
C. The destination type can be larger or smaller than source type.
D. None of the mentioned
Answer: B

17. What is the error in this code? byte b = 50; b = b * 50;


A. b can not store the result 2500, limited by its range.
B. * operator has converted b * 50 into int, which can not be converted to byte without casting.
C. b can not contain value 50.
D. No error in this code
Answer: B

18. Which of these is an incorrect array declaration?


A. int arr[] = new int[5];
B. int [] arr = new int[5];
C. int arr[]; arr = new int[5];
D. int arr[] = int [5] new
Answer: D

19. Which of these selection statements test only for equality?


A. if
B. switch
C. Both a & b
D. None of the mentioned
Answer: B

20. Which of these are selection statements in Java?


A. if
B. for
C. continue
D. all of these
Answer: A

21. Which of these jump statements can skip processing remainder of code in its
body for a particular iteration?
A. break

View all MCQ's at McqMate.com


B. return
C. exit
D. continue
Answer: D

22. What is the value of the expression 2 & 3 ?


A. 2
B. 3
C. 6
D. 5
Answer: A

23. What is the value of the expression 8 << 2 ?


A. 2
B. 32
C. 1 6
D. 5
Answer: B

24. The keyword used to create a constant variable


A. const
B. static
C. final
D. none of these
Answer: C

25. What is stored in the object obj in following lines of code? box obj;
A. Memory address of allocated memory of object.
B. NULL
C. Any arbitrary pointer
D. Garbage
Answer: B

View all MCQ's at McqMate.com

You might also like