Home Latest Jobs Syllabus Projects Previous Question Papers Entrance Exam Notifications Multiple Choice Question

AP ECET COMPUTER SCIENCE AND ENGINEERING Multiple Choice Questions (MCQs)

MCQs for Java Programming

AP ECET Computer Science and Engineering - Java Programming

  1. Which of the following is the correct syntax for defining a class in Java?

    • a) class MyClass()
    • b) class MyClass {}
    • c) MyClass class {}
    • d) class = MyClass {}

    Answer: b) class MyClass {}

  2. Which of the following keywords is used to prevent a method from being overridden in Java?

    • a) final
    • b) static
    • c) abstract
    • d) private

    Answer: a) final

  3. What is the default value of a local variable in Java?

    • a) null
    • b) 0
    • c) Undefined
    • d) It does not have a default value

    Answer: d) It does not have a default value

  4. Which of the following is true about constructors in Java?

    • a) A constructor can be called explicitly.
    • b) Constructors are not inherited.
    • c) Constructors have a return type.
    • d) Constructors can be called multiple times in an object’s lifetime.

    Answer: b) Constructors are not inherited.

  5. Which of the following is used to implement multiple inheritance in Java?

    • a) Interface
    • b) Abstract class
    • c) Class
    • d) Both a and b

    Answer: a) Interface

  6. Which of the following is used to handle exceptions in Java?

    • a) catch
    • b) throw
    • c) finally
    • d) All of the above

    Answer: d) All of the above

  7. In Java, which method is used to start a thread?

    • a) init()
    • b) start()
    • c) run()
    • d) begin()

    Answer: b) start()

  8. What is the size of an int variable in Java?

    • a) 16-bit
    • b) 32-bit
    • c) 64-bit
    • d) 8-bit

    Answer: b) 32-bit

  9. Which of the following is the superclass of all classes in Java?

    • a) Object
    • b) Class
    • c) System
    • d) Thread

    Answer: a) Object

  10. Which of the following is the correct way to declare an array in Java?

    • a) int[] arr = new int[5];
    • b) int arr[5];
    • c) array int[] arr = new array[5];
    • d) array arr = new array[5];

    Answer: a) int[] arr = new int[5];

  11. Which method is used to read a character from the keyboard in Java?

    • a) readLine()
    • b) read()
    • c) getchar()
    • d) nextChar()

    Answer: b) read()

  12. In Java, which of the following is the correct way to create a new thread?

    • a) Thread t = new Thread();
    • b) Thread t = new Thread(Runnable);
    • c) Thread t = new Runnable();
    • d) Both a and b

    Answer: d) Both a and b

  13. What will be the output of the following Java code snippet?

            int x = 10;
            int y = 20;
            System.out.println(x + y);
            
    • a) 1020
    • b) 30
    • c) 10 20
    • d) Error

    Answer: b) 30

  14. What is the correct way to handle a file operation exception in Java?

    • a) try-catch block
    • b) throws declaration
    • c) try-throw block
    • d) Both a and b

    Answer: d) Both a and b

  15. Which of the following is NOT a feature of Java's AWT (Abstract Window Toolkit)?

    • a) It provides a set of graphical user interface components.
    • b) It is platform-independent.
    • c) It handles mouse events.
    • d) It is used for creating graphical applications.

    Answer: b) It is platform-independent.



    << Previous Page    l    Next Page >>

Note/Caution: studentsbizz.com does not promise a job or an interview in exchange for money. Fraudsters may ask you to pay under the pretext of a registration fee or refundable fee, but please be aware that legitimate employers will not require such payments.