Computer Knowledge

Java Core Classes and Threads

1,935 Questions

Java core classes and threads form the foundation of object oriented programming and are crucial for IT officer and programming exams. This includes concepts like string mutability, collections, and multithreading. Solve these questions to test your practical coding and theoretical knowledge.

String and StringBuffer classesThread execution methodsJava collections frameworkCharacter streams input outputVariable serialization rules

Java Core Classes and Threads Questions

Multiple choice technology security
  1. Line 5

  2. Line 4

  3. Line 18

  4. Line 11

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Line 18 contains a vulnerability because it logs the raw, sensitive password parameter. In contrast, the SQL query execution on lines 3-7 is secure since it uses a parameterized PreparedStatement which prevents SQL injection.

Multiple choice technology security
  1. Race Condition

  2. Command Injection

  3. Denial of Service

  4. Cross Site Request Forgery

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The parameter path is fetched directly from the request and concatenated into a shell command executed by Runtime.getRuntime().exec(). An attacker can manipulate this parameter (e.g., using & or |) to execute arbitrary command line arguments on the host system.

Multiple choice technology security
  1. Line # 4

  2. Line # 13 & 20

  3. Line # 7 & 8

  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Lines 7 and 8 contain the security vulnerabilities. Line 7 loads the obsolete and insecure JDBC-ODBC bridge driver. Line 8 contains hardcoded database credentials ("admin"/"admin"), exposing the application to credential theft and unauthorized access.