Important Java Language MCQ


Q.-1: Java is developed by

A) Sun Microsoft System
B) Sun MenuSystem
C) Sun MicroSystem
D) None of these


Q.-2: API stands for ..............................

A) Application Program Interconnection
B) Application Program Interconnectivity
C) Application Program Interface
D) None of these


Q.-3: Array are not used to group storage locations.

A) TRUE
B) False
C)
D)


Q.-4: While is a/an .......................

A) switch construct
B) break construct
C) repetitive statement
D) None of these


Q.-5: Which of the following can be operands of arithmetic operators?

A) Numeric
B) Boolean
C) Characters
D) Both Numeric & Characters


Q.-6: Modulus operator, %, can be applied to which of these?

A) Integers
B) Floating ? point numbers
C) Both Integers and floating ? point numbers
D) None of the mentioned


Q.-7: Decrement operator "--" decreases the value of variable by what number?

A) 1
B) 2
C) 3
D) 4


Q.-8: Which of these can be returned by the operator &?

A) Integer
B) Boolean
C) Character
D) Integer or Boolean


Q.-9: Which statement is true regarding an object?

A) An object is what classes instantiated are from
B) An object is an instance of a class
C) An object is a variable
D) An object is a reference to an attribute


Q.-10: In object-oriented programming, composition relates to

A) The use of consistent coding conventions
B) The organization of components interacting to achieve a coherent, common behavior
C) The use of inheritance to achieve polymorphic behavior
D) The organization of components interacting not to achieve a coherent common behavior


Q.-11: What is garbage collection in the context of Java?

A) The operating system periodically deletes all of the java files available on the system
B) Any package imported in a program and not used is automatically delete
C) When all references to an object are gone, the memory used by the object is automatically reclaime
D) The JVM checks the output of any Java program and deletes anything that doesn?t make sense


Q.-12: A package is a collection of

A) Classes
B) Interfaces
C) Editing tools
D) Classes and interfaces


Q.-13: Basic Java language functions are stored in which of the following java package?

A) java.lang
B) java.io
C) java.net
D) java.util


Q.-14: Scanner class stored in which of the following java package?

A) java.lang
B) java.io
C) java.net
D) java.util


Q.-15: What is the fundamental unit of information of writer streams?

A) Characters
B) Bytes
C) Files
D) Records (e) Information


Q.-16: File class is included in which package?

A) java.io package
B) java.lang package
C) java.awt package
D) java.net.package


Q.-17: Which one of these is a valid method declaration?

A) void method1
B) void method3(void)
C) void method2()
D) method4()


Q.-18: Which statement is true about accessibility of members?

A) Private members are always accessible from within the same package
B) Private members can only be accessed by code from within the class of the member
C) A member with default accessibility can be accessed by any subclass of the class in which it is defi
D) Private members cannot be accessed at all


Q.-19: Give the abbreviation of AWT?

A) Applet Windowing Toolkit
B) Abstract Windowing Toolkit
C) Absolute Windowing Toolkit
D) None of the above


Q.-20: Which method is used to set the graphics current color to the specified color in the graphics class?

A) public abstract void setFont(Font font)
B) public abstract void setColor(Color)
C) public abstract void drawString(String str, int x, int y)
D) None of the above


21 In Graphics class which method is used to draws a rectangle with the specified width and height?

A) public void drawRect(int x, int y, int width, int height)
B) public abstract void fillRect(int x, int y, int width, int height)
C) public abstract void drawLine(int x1, int y1, int x2, int y2)
D) public abstract void drawOval(int x, int y, int width, int height)


Q.-22: From the following statements which is a disadvantage of an java array?

A) An array can hold primitive types data
B) An array has its size that is known as array length
C) An array knows only its type that it contains. Array type is checked at the compile-time
D) An array holds only one type of data


Q.-23: Which of the following encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed?

A) DriverManager
B) JDBC driver
C) Connection
D) Statement


Q.-24: What is, in terms of JDBC, a DataSource?

A) A DataSource is the basic service for managing a set of JDBC drivers
B) A DataSource is the Java representation of a physical data source
C) A DataSource is a registry point for JNDI-services
D) A DataSource is a factory of connections to a physical data source


Q.-25: Which packages contain the JDBC classes?

A) java.jdbc and javax.jdbc
B) java.jdbc and java.jdb.sql
C) java.sql and javax.sql
D) java.rdb and javax.rdb


Q.-26: To run a compiled Java program, the machine must have what loaded and running?

A) Java virtual machine
B) Java compiler
C) Java bytecode
D) A Web browser


Q.-27: Which method is used to perform DML statements in JDBC?

A) execute()
B) executeQuery()
C) executeUpdate()
D) executeResult()


Q.-28: Which of the following methods are needed for loading a database driver in JDBC?

A) registerDriver() method
B) Class.forName()
C) Both A and B
D) getConnection()


Q.-29: Which are the new features adding in to the JDBC 4.0?

A) Auto-loading of JDBC driver class
B) Connection management enhancements
C) Support for RowId SQL type
D) All of the above


Q.-30: URL stands for

A) Universal reader locator
B) Universal reform loader
C) Uniform resource loader
D) Uniform resource locator