Java - Language Fundamentals Questions and Answers

Practice Mode
Showing 10 of 39 questions
Q31
Which feature makes Java platform independent?
  • A Object-oriented nature
  • B Use of pointers
  • C Explanation: Java bytecode runs on any JVM, making it platform independent.
  • D Multithreading
Answer: Option C
Explanation: Java bytecode runs on any JVM, making it platform independent.
Q32
What will be the output of System.out.println(10 + 20 + "Java");?
  • A Java30
  • B 1020Java
  • C Explanation: Integer addition occurs before string concatenation.
  • D Java1020
Answer: Option C
Explanation: Integer addition occurs before string concatenation.
Q33
Which of the following is a valid array declaration?
  • A int arr[];
  • B int[] arr;
  • C arr int[];
  • D Explanation: Both array declaration styles are valid in Java.
Answer: Option D
Explanation: Both array declaration styles are valid in Java.
Q34
Which keyword refers to the current object in Java?
  • A Explanation: this refers to the current object instance.
  • B super
  • C current
  • D self
Answer: Option A
Explanation: this refers to the current object instance.
Q35
Which literal represents a long data type?
  • A 100
  • B Explanation: L suffix indicates a long literal.
  • C 100.0
  • D '100'
Answer: Option B
Explanation: L suffix indicates a long literal.
Q36
Which keyword prevents a method from being overridden?
  • A static
  • B private
  • C Explanation: final methods cannot be overridden.
  • D abstract
Answer: Option C
Explanation: final methods cannot be overridden.
Q37
Which class is commonly used to take input from the keyboard?
  • A System
  • B Explanation: Scanner is widely used for user input.
  • C BufferedReader
  • D InputStream
Answer: Option B
Explanation: Scanner is widely used for user input.
Q38
Which of the following is NOT a valid Java keyword?
  • A volatile
  • B transient
  • C strictfp
  • D Explanation: Java does not support the unsigned keyword.
Answer: Option D
Explanation: Java does not support the unsigned keyword.
Q39
Which of the following best describes Java?
  • A Procedure-oriented
  • B Platform dependent
  • C Explanation: Java follows object-oriented programming principles.
  • D Machine dependent
Answer: Option C
Explanation: Java follows object-oriented programming principles.
Questions and Answers for Competitive Exams Various Entrance Test