TCS Java - PLSQL - SQL Mock - Quizizz
TCS Java - PLSQL - SQL Mock - Quizizz
1. 1. Which of the following is used to compare two Strings in Java for equality?
a) A) == b) B) .compareTo()
c) C) .equals() d) D) .compare()
2. What is the output of the following code snippet? public class Test { public static void main(String[] args) { int x = 5; int y = 10; System.out.println(x >
y ? x : y); } }
a) A) 5 b) B) 10
c) C) true d) D) false
a) A) synchronized b) B) transient
c) C) include d) D) volatile
a) A) run() b) B) begin()
c) C) execute() d) D) start()
5. Which of the following can be used to handle multiple exceptions in a single catch block?
a) A) Using multiple catch blocks b) B) Using a single catch block with | operator
6. Which of the following collection types is ordered and allows duplicate elements?
a) A) Set b) B) List
c) C) Map d) D) Queue
8. What is the output of the following code? public class Test { public static void main(String[] args) { int i = 0; for (System.out.println("Start"); i < 3; i++) {
System.out.println(i); } } }
c) C) 0, 1, 2 d) D) Start, 1, 2, 3
9. What will be the output of the following code? public class Test { public static void main(String[] args) { String s1 = "Java"; String s2 = "Java";
System.out.println(s1 == s2); } }
a) A) true b) B) false
a) A) protected b) B) public
11. Which of the following statements is true about the finally block?
a) A) finally is optional and is executed only if no exceptions are thrown. b) B) finally is executed only if an exception is thrown.
c) C) finally is always executed, regardless of whether an exception is d) D) finally must contain code to close the exception.
thrown.
12. Which of these statements is true about the HashMap collection in Java?
13. In Java, which keyword is used to refer to the current instance of a class?
a) A) that b) B) this
c) C) super d) D) instance
14. public class Test { public static void main(String[] args) { System.out.println(Math.min(Double.MIN_VALUE, 0.0d)); } }
a) A) 0.0 b) B) Double.MIN_VALUE
c) C) Compilation error d) 0
15. Which of the following is true about the final keyword in Java?
a) A) It allows a method to be overridden. b) B) It can be used with classes, methods, and variables.
a) A) SELECT b) B) GET
c) C) FETCH d) D) EXTRACT
a) A) ORDER BY b) B) GROUP BY
c) C) WHERE d) D) HAVING
19. Which of the following SQL keywords is used to sort the result-set in ascending or descending order?
a) A) ORDER BY b) B) SORT BY
c) C) GROUP BY d) D) FILTER BY
20. In SQL, which operator is used to check for the existence of a value in a subquery?
a) A) IN b) B) BETWEEN
c) C) EXISTS d) D) LIKE
a) A) VARCHAR2 b) B) BOOLEAN
c) C) INTEGER d) D) LIST
22. What will the following SQL query return? SELECT * FROM employees WHERE salary BETWEEN 50000 AND 100000;
a) A) Employees with salary less than 50,000 b) B) Employees with salary more than 100,000
c) C) Employees with salary between 50,000 and 100,000 inclusive d) D) Employees with salary equal to 50,000 and 100,000 only
a) A) It selects rows with only unique values in the specified columns. b) B) It filters the records based on conditions.
a) A) WHEN b) B) EXCEPTION
c) C) HANDLE d) D) CATCH
25. In PL/SQL, which of the following is true about stored procedures?
c) C) They can be called with or without parameters. d) D) They must return a value.
Answer Keys
1. c) C) .equals() 2. b) B) 10 3. c) C) include
10. d) D) package-private (no modifier) 11. c) C) finally is always executed, regardless 12. d) None of these
of whether an exception is thrown.
13. b) B) this 14. a) A) 0.0 15. b) B) It can be used with classes, methods,
and variables.
22. c) C) Employees with salary between 23. a) A) It selects rows with only unique 24. b) B) EXCEPTION
50,000 and 100,000 inclusive values in the specified columns.