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

Java MCQ 17 10 23

The document discusses key Java concepts like platform independence, byte code, JVM, JDK, variables, scopes, access modifiers, data types, literals and more. Java is a platform independent language that compiles source code to byte code to be run on a JVM. Variables are names given to memory locations and can be initialized dynamically. Access modifiers control visibility and scopes determine lifetime.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Java MCQ 17 10 23

The document discusses key Java concepts like platform independence, byte code, JVM, JDK, variables, scopes, access modifiers, data types, literals and more. Java is a platform independent language that compiles source code to byte code to be run on a JVM. Variables are names given to memory locations and can be initialized dynamically. Access modifiers control visibility and scopes determine lifetime.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1. ___________is one of the java features that enables java program to run anywhere anytime.

a. multithreaded
b. platform independent
c. dynamic
d. robust

Answer: b. platform independent

2. Java compiler translates source code into_________.


a. byte code
b. machine code
c. binary code
d. user code

Answer: a. byte code

3. JVM is platform__________.
a. dependent
b. independent
c. Both
d. none of them

Answer: a. dependent

4. JDK is the collection of runtime environment and ___________.


a. development tools
b. libraries
c. classes
d. none of them

Answer: a. development tools

5. Variable is a _________.
a. container
b. name given to a location inside memory area
c. value
d. none of the above

Answer: b. name given to a location inside memory area

6. Instance Variables in java are known as_______.


a. Static fields
b. non static fields
c. local
d. all of them

Answer: b. non static fields

7. Scope of the static variable is _________.


a. thorough out the file
b. throughout the class
c. inside a package
d. none of them
Answer: a. thorough out the file

8. Life time of Instance variable is __________.


a. As per the runtime of source file
b. up-to the destruction of object
c.
d.

Answer: b. up-to the destruction of object

9. We can initialize a variable dynamically by __________.


a. Scanner class
b. constructor
c. build-in API’s
d. All of them

Answer: d. All of them

10. Which statement is true about Java?


a. Java is a sequence-dependent programming language
b. Java is a code dependent programming language
c. Java is a platform-dependent programming language
d. Java is a platform-independent programming language

Answer: d. Java is a platform-independent programming language

11. Which of these cannot be used for a variable name in Java?


a. identifier & keyword
b. identifier
c. keyword
d. none of the mentioned

Answer: a. identifier & keyword

12. What is the extension of java code files?


a) .js b) .txt c) .class d) .java

Answer: d) .java

13. Which environment variable is used to set the java path?


a. MAVEN_Path
b. JavaPATH
c. JAVA
d. JAVA_HOME

Answer: d. JAVA_HOME

14. What is the extension of compiled java classes?


a) .txt
b) .js
c) .class
d) .java

Answer: c) .class
15. Which one of the following is not an access modifier?
a. Protected
b. Void
c. Public
d. Private

Answer: b. Void

16. Literal can be of which of these data types?


a. integer
b. float
c. boolean
d. all of the mentioned

Answer d. all of the mentioned

17. Which data type value is returned by all transcendental math functions?
a. int
b. float
c. double
d. long

Answer: c. double

18. Which of these coding types is used for data type characters in Java?
a. ASCII
b. ISO-LATIN-1
c. UNICODE
d. None of the mentioned

Answer: c. UNICODE

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


a. True & False
b. 0 & 1
c. Any integer value
d. true

Answer: b. True & False

20. What is the numerical range of a char data type in Java?


a. -128 to 127
b. 0 to 256
c. 0 to 32767
d. 0 to 65535

Answer: d. 0 to 65535

You might also like