Programming MCQs

Java MCQ Questions and Answers set-5

Pinterest LinkedIn Tumblr

Here are the collections of Java MCQ questions and answers includes multiple-choice questions on fundamental of Java programming language with answers. It includes MCQ questions on basic commands used on JDBC, Java servlet methods, and Java variables used in java along with their answers.

1. Prepared statement Object in JDBC is used to execute ……………………… queries.
A) executable
B) simple
C) high level
D) parameterized

2. In JDBC …………………… imports all Java classes concerned with database connectivity.
A) javax.sql.*
B) java.mysql.*
C) java.sql.*
D) com.*

3. MS-SQL stores data in a …………………… file format.
A) .DAT
B) .MDB
C) .MSSQL
D) .OBJ

4. Ingres is a ……………………
A) Socket
B) Compiler
C) Database
D) Web server

5. In Java servlet method init( ) is called ………………… times.
A) 1
B) 2
C) 0
D) multiple

6. State true or false for Java Program.
i) All class variables are instance variables
ii) All protected methods are friendly methods
A) i-false, ii-false
B) i-false, ii-true
C) i-true, ii-false
D) i-true, ii-true

7. State true or false for Java Program.
i) Data members of an interface are by default final
ii) An abstract class has implementations of all methods defined inside it.
A) i-false, ii-false
B) i-false, ii-true
C) i-true, ii-false
D) i-true, ii-true

8. …………………… of a remotely accessible object must implement …………….
A) all methods, RemoteException
B) class, RemoteException
C) class, RemoteInterface
D) all methods, RemoteInterface

9. ………………….is the key to ……………………
A) Serialization, persistence
B) Persistence, inheritance
C) Inheritance, object
D) Persistence, serialization

10. A method name myMethod( ) that needs two integer arguments is declared as
A) public void myMethod( );
B) public void myMethod(int a, int b);
C) public void myMethod(int a, b);
D) public int myMethod(a, b);

Answers:

1.  D) parameterized
2.  C) java.sql.*
3.  A) .DAT
4.  C) Database
5.  A) 1
6.  B) i-false, ii-true
7.  C) i-true, ii-false
8.  C) class, RemoteInterface
9.  A) Serialization, persistence
10.B) public void myMethod(int a, int b);

Read Next: Java Multiple Choice Questions With Answers set-6
Read More: Collection of Java MCQ Questions and Answers

Author

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Comments are closed.