The correct answers:
1. What is a constructor?
- b. Input function that initializes variables
2. Why super keyword is used in inheritance?
- b. To access member of the parent class
3. Why JDBC is there in Java?
- c. To create a database and execute queries
4. How is a new class derived from an old class in Java?
- a. class child extends parent()
5. Why is the static keyword always there in front of the main method in Java?
- d. Because the main method needs to be invoked before any object instantiation
6. Which of the following is not a valid loop statement in Java?
- c. for(false){}
7. What is late binding in Java?
- b. Association of object and methods in runtime
8. Which of the following methods is used to execute an alter statement of SQL in a Java program?
- c. executeUpdate()
9. Which of the following is not a string method in Java?
- d. gets()
10. Exception class in Java is derived from
- a. Throwable
The correct answers:
1. What stands for IRE?
- a. Java Runtime Environment
2. Which statement is used for terminating loops?
- a. break
3. Which statement is false about constructors?
- c. It cannot contain arguments
4. Which of the following is valid syntax for single inheritance?
- b. class A extends B
5. Which keyword is used for accessing members of the parent class?
- c. super
6. How many numbers of threads can be in the ready state at a time?
- d. many
7. Which of the following is a byte stream class?
- c. FileInputStream
8. Which package contains classes related to event handling?
- b. java.awt.event
9. What is the name of the method used for running insert commands in JDBC?
- b. executeUpdate
10. Which of the following is the default access specifier for interfaces?
- b. public
The correct answers:
1. Which of these keywords is used by a class to use an interface defined previously?
- c. implements
2. In a Java program, which of the following is true about package declaration?
- a. must precede
3. Which method is called internally by the Thread start() method?
- d. run
4. Using which keyword can you access the value of the instance variables and class variables inside the method of the class?
- d. either super or this
5. Which component is used to compile, debug, and execute a Java program?
- b. JDK
6. Which of these keywords is not a part of exception handling?
- c. thrown
7. Which of the following statements about abstract methods/classes in Java is true?
- a. An abstract class cannot be instantiated.
8. Which keyword is used to insert an interface by another interface?
- b. extends
9. What type of event is generated when the user presses the enter key in a JTextField?
- a. ActionEvent
10. Which JDBC driver Type(s) is/are the JDBC-ODBC bridge?
- a. Type 1
No comments:
Post a Comment