Advanced Topics MCQs

  1. Which of the following is true about Java performance optimization?
    a) Use efficient data structures
    b) Minimize object creation
    c) Optimize algorithms
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  2. Which JVM option enables garbage collection logging?
    a) -Xms
    b) -Xmx
    c) -verbose:gc
    d) -XX:+UseParallelGC
    View Answer

    Correct answer: C — -verbose:gc

  3. What will be printed?
    1 System.out.println(Runtime.getRuntime().availableProcessors() > 0);
    a) true
    b) false
    c) Compilation error
    d) Runtime exception
    View Answer

    Correct answer: A — true

  4. Which of the following is true about memory leaks in Java?
    a) Caused by objects not garbage collected
    b) Common with static references
    c) Can be detected with profiling tools
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  5. Which of the following is NOT a garbage collector in Java?
    a) G1 GC
    b) CMS GC
    c) ZGC
    d) SQL GC
    View Answer

    Correct answer: D — SQL GC

  6. Which of the following is true about JVisualVM?
    a) Monitors JVM performance
    b) Profiles CPU and memory usage
    c) Detects memory leaks
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  7. Which of the following is true about heap vs stack memory?
    a) Heap stores objects
    b) Stack stores method frames
    c) Stack is faster but limited
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  8. What will be printed?
    1 int[] arr = new int[5];
    2 System.out.println(arr.length);
    a) 4
    b) 5
    c) Compilation error
    d) Runtime exception
    View Answer

    Correct answer: B — 5

  9. Which of the following is true about Java profiling tools?
    a) JProfiler
    b) YourKit
    c) JVisualVM
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  10. Which of the following is true about thread dumps?
    a) Show thread states
    b) Help diagnose deadlocks
    c) Useful for debugging concurrency issues
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  11. Which of the following is true about Java Flight Recorder (JFR)?
    a) Low overhead profiling tool
    b) Captures JVM events
    c) Integrated with Mission Control
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  12. Which of the following is NOT a JVM memory area?
    a) Heap
    b) Stack
    c) Metaspace
    d) CacheSpace
    View Answer

    Correct answer: D — CacheSpace

  13. Which of the following is true about performance tuning best practices?
    a) Use caching
    b) Optimize database queries
    c) Avoid unnecessary synchronization
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  14. What will be printed?
    1 String s = null;
    2 System.out.println(s == null);
    a) true
    b) false
    c) Compilation error
    d) Runtime exception
    View Answer

    Correct answer: A — true

  15. Which of the following is true about deadlocks?
    a) Occur when threads wait on each other
    b) Can be detected via thread dumps
    c) Prevented by avoiding circular waits
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  16. Which of the following is true about Java memory management improvements in JDK 11+?
    a) Introduction of ZGC
    b) Improved G1 GC
    c) Better heap fragmentation handling
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  17. Which of the following is true about debugging tools in Java?
    a) JDB (Java Debugger)
    b) IDE debuggers (Eclipse, IntelliJ)
    c) Remote debugging support
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  18. Which of the following is true about performance bottlenecks?
    a) Can occur in CPU usage
    b) Can occur in memory allocation
    c) Can occur in I/O operations
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  19. Which of the following is NOT a Java profiling tool?
    a) JProfiler
    b) YourKit
    c) Eclipse Memory Analyzer
    d) Oracle SQL Developer
    View Answer

    Correct answer: D — Oracle SQL Developer

  20. What will be printed?
    1 System.out.println(Integer.MAX_VALUE + 1);
    a) Overflow to negative
    b) Compilation error
    c) Runtime exception
    d) Positive infinity
    View Answer

    Correct answer: A — Overflow to negative

  21. Which of the following is true about JVM heap dump analysis?
    a) Identifies memory leaks
    b) Shows object references
    c) Helps optimize memory usage
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  22. Which of the following is NOT a JVM garbage collector?
    a) G1 GC
    b) ZGC
    c) CMS
    d) SQL GC
    View Answer

    Correct answer: D — SQL GC

  23. What will be printed?
    1 System.out.println(Math.min(10, 20));
    a) 10
    b) 20
    c) Compilation error
    d) Runtime exception
    View Answer

    Correct answer: A — 10

  24. Which of the following is true about thread pools?
    a) Reuse threads for tasks
    b) Reduce overhead of thread creation
    c) Improve performance in concurrent apps
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  25. Which of the following is true about Java Mission Control?
    a) Works with Flight Recorder
    b) Provides performance analysis
    c) Helps identify bottlenecks
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  26. Which of the following is true about synchronized blocks?
    a) Ensure thread safety
    b) May reduce performance
    c) Should be used carefully
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  27. Which of the following is NOT a Java debugging tool?
    a) JDB
    b) IntelliJ Debugger
    c) Eclipse Debugger
    d) SQL Profiler
    View Answer

    Correct answer: D — SQL Profiler

  28. What will be printed?
    1 String s = "Eduinq";
    2 System.out.println(s.hashCode() > 0);
    a) true
    b) false
    c) Compilation error
    d) Runtime exception
    View Answer

    Correct answer: A — true

  29. Which of the following is true about performance profiling techniques?
    a) Sampling provides statistical data
    b) Instrumentation provides detailed tracing
    c) Both have trade offs
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  30. Which of the following is true about Java memory tuning?
    a) Adjust heap size with -Xms/-Xmx
    b) Use GC tuning flags
    c) Monitor with profiling tools
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  31. Which of the following is true about deadlock detection?
    a) Thread dumps show blocked threads
    b) Tools like JConsole can detect deadlocks
    c) Avoid circular waits to prevent them
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  32. Which of the following is NOT a JVM memory area?
    a) Heap
    b) Stack
    c) Metaspace
    d) CacheSpace
    View Answer

    Correct answer: D — CacheSpace

  33. Which of the following is true about Java performance best practices?
    a) Use efficient algorithms
    b) Optimize database queries
    c) Minimize synchronization overhead
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  34. What will be printed?
    1 System.out.println(Integer.parseInt("100") + 50);
    a) 150
    b) 10050
    c) Compilation error
    d) Runtime exception
    View Answer

    Correct answer: A — 150

  35. Which of the following is true about JProfiler?
    a) Provides CPU profiling
    b) Provides memory profiling
    c) Detects thread issues
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  36. Which of the following is true about Eclipse Memory Analyzer (MAT)?
    a) Analyzes heap dumps
    b) Detects memory leaks
    c) Provides object reference graphs
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  37. Which of the following is true about performance bottlenecks in Java?
    a) Can occur in CPU usage
    b) Can occur in memory allocation
    c) Can occur in I/O operations
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  38. Which of the following is NOT a JVM tuning parameter?
    a) -Xms
    b) -Xmx
    c) -XX:+UseG1GC
    d) -XX:+UseSQLGC
    View Answer

    Correct answer: D — -XX:+UseSQLGC

  39. What will be printed?
    1 System.out.println("Debug".length());
    a) 4
    b) 5
    c) 6
    d) Compilation error
    View Answer

    Correct answer: B — 5

  40. Which of the following is true about Java Flight Recorder events?
    a) Capture GC activity
    b) Capture thread states
    c) Capture I/O operations
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  41. Which of the following is true about best practices in debugging?
    a) Use logging frameworks
    b) Avoid System.out.println for debugging
    c) Use breakpoints in IDEs
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  42. Which of the following is true about JVM Metaspace?
    a) Stores class metadata
    b) Replaced PermGen in JDK 8
    c) Grows dynamically
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  43. Which of the following is true about thread safety best practices?
    a) Use immutable objects
    b) Use concurrent collections
    c) Minimize shared state
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  44. Which of the following is true about performance optimization in databases?
    a) Use indexes
    b) Optimize queries
    c) Use connection pooling
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  45. What will be printed?
    1 System.out.println(Math.max(50, 100));
    a) 50
    b) 100
    c) Compilation error
    d) Runtime exception
    View Answer

    Correct answer: B — 100

  46. Which of the following is true about Java thread dumps analysis?
    a) Identify blocked threads
    b) Detect deadlocks
    c) Analyze thread states
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  47. Which of the following is true about profiling vs monitoring?
    a) Profiling is detailed analysis
    b) Monitoring is continuous observation
    c) Both are complementary
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  48. Which of the following is NOT a Java logging framework?
    a) Log4j
    b) SLF4J
    c) java.util.logging
    d) SQLLogger
    View Answer

    Correct answer: D — SQLLogger

  49. Which of the following is true about Java performance testing tools?
    a) JMeter for load testing
    b) Gatling for performance testing
    c) Apache Bench for benchmarking
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  50. Which of the following is true about Advanced Topics overall?
    a) Improve application performance
    b) Enhance debugging and profiling
    c) Ensure efficient memory management
    d) All of the above
    View Answer

    Correct answer: D — All of the above

Quick Links to Explore