You are on page 1of 2

1. What is correct syntax for main method of a java class?

(A) public static int main(String[] args) (B) public int main(String[] args) (C)
public static void main(String[] args) (D) None of the above.
2. An IF statement in Java is also a _____ statement (a) Boolean (b) Conditional
(c) iterative (d) optional
3. What is inheritance?
(A) It is the process where one object acquires the properties of another. (B)
Inheritance is the ability of an object to take on many forms. (C) inheritance is a
technique to define different methods of same type. (D) None of the above.
4. State TRUE or FALSE. Every IF statement must be followed by an ELSE of
ELSE-IF statement. (a) TRUE (b) FALSE (c) All of the above (d) None of the
above
5 State TRUE or FALSE. The code inside an ELSE statement may be surrounded
by Braces. (a) FALSE (b) TRUE (c) None of the above d) All of the above
https://www.tutorialspoint.com/java/java_mock_test.htm
6. What is a correct syntax to output "Hello World" in Java?
(A) echo("Hello World"); (B) Console.WriteLine("Hello World"); (C) print
("Hello World"); (D) System.out.println("Hello World");
7. Java is short for "JavaScript".
(A) False (B) True (C) None of the above (D) All of the above
8. How do you insert COMMENTS in Java code?
(A) /* This is a comment (B) // This is a comment (C) # This is a comment (D)
None of the above
9. Which data type is used to create a variable that should store text?
(A) String (B) Int (C) mydouble (D) Txt
10. How do you create a variable with the numeric value 5?
(A) num x = 5 (B) int x = 5; (C)float x = 5; (D) x = 5;
11. How do you create a variable with the floating number 2.8?
(A) x = 2.8f; (B) byte x = 2.8f (C) float x = 2.8f; (D) int x = 2.8f;
12. Which operator is used to add together two values?
(A) The & sign (B) The + sign (C) The * sign (D)None of the above
13. The value of a string variable can be surrounded by double quotes.
(A) True (B) False (C)All of the above (D)None of the above
14. Which operator can be used to compare two values?
(A) >< (B) = (C) <> (D) ==
15. Which keyword is used to create a class in Java?
(A) class() (B) class (C)MyClass (D) className
16. In Java, it is possible to inherit attributes and methods from one class to
another.
(A) False (B) True (C) All of the above (D) None of the above
17. Which operator is used to multiply numbers?
(A) % (B) * (C) x (D) #
https://www.w3schools.com/quiztest/quiztest.asp?qtest=JAVA
18. Which of these statement is incorrect?
(a) Every class must contain a main() method (b) Applets do not require a main()
method at all (c) There can be only one main() method in a program (d) main()
method must be made public
19. Which of the following statements is correct?
(a) Public method is accessible to all other classes in the hierarchy (b) Public
method is accessible only to subclasses of its parent class (c) Public method can
only be called by object of its class (d) Public method can be accessed by calling
object of the public class
20. What is byte code in Java?
(A) Code generated by a Java compiler (B) Code generated by a Computer
Machine
(C) Name of Java source code file (D) Block of code written inside a class
https://www.sanfoundry.com/java-questions-answers-freshers-experienced/

THEORY
1. What are conditional statement? With which commands do you implement
conditional statement in java. 5 MARKS
2. 2. What are relational operators? State the difference between = and = =
5 MARKS
3. Differentiate between if and switch statement. 5 MARKS
4. Write a java program to find the area of circle. 5 MARKS
5. Write a java program to find the area of parallelogram. Given Area(A) =
Base(B) * Height(H) 5 MARKS

You might also like