Chapter-1 Programming using IDE
1.______________ provides a way to interact with the different components of JAVA through visual graphical elements (Pictures, icons, symbols, etc.).
(a) IDE
(b) NetBeans
(c) Jar
(d) Interface
(d) Interface
2. ______________ window displays a hierarchical tree structure of all the components used in the current form.
(a) Project
(b) Palette
(c) Inspector
(d) Properties
(c)Inspector
3. ______________provides the various commands used to work with Net Beans IDE, such as file, edit, view, etc.
(a) Title Bar
(b) Tool Bar
(c) Menu Bar
(d) Scroll Bar
(c)Menu Bar
4. Who initiated the Java language?
(a) James Gosling
(b) Bjarne
(c) Larry Page
(d) DCP
(a) James Gosling
5. ______________ is a runtime environment which acts as an interpreter and translates the byte code into object code.
(a) Javac
(b) jar
(c) javadoc
(d) JVM
(d) JVM
6. Applets are java program executed by a _________________.
(a) JVM
(b) JRE
(c) Web Browser
(d) IDE
(c) Web Browser
7. ______________ is software program that is designed to help programmers and develpoers to build software.
(a) RAD
(b) IDE
(c) JDK
(d) JRE
(b) IDE
8. Java Source Code is compiled into ______________.
(a) . obj
(b) .exe
(c) Bytecode
(d) Source Code
(c) Bytecode
9. ______________converts byte code to machine language code.
(a) Javac
(b) jar
(c) javadoc
(d) JVM
(d) JVM
10. ______________ is a software tool which provides a way to create and debug programs easily.
(a) RAD
(b) IDE
(c) JDK
(d) JRE
(b) IDE
11. Java compiler is named as ______.
(a) Java
(b) javac
(c) JRE
(d) jar
(b) javac
12. Which of the tool is used to compile java code ?
(a) jar
(b) javac
(c) javadoc
(d) java
(b) javac
13. ______________ is a program development environment for writing Java applets and applications.
(a) RAD
(b) IDE
(c) JDK
(d) JRE
JDK
14.The set of instructions in a programming language is called _______.
(a) Data
(b) Information
(c) Process
(d) Program
(d) Program
15.Java is originally known as _______.
(a) C
(b) D
(c) OAK
(d) NetBean
(c) OAK
16.Java Programming was designed by _______.
(a) Sun Microsystem
(b) Microsoft
(c) TCS
(d) Wipro
(a) Sun Microsystem
Chapter-2 Programming Fundamentals
1. Which of the following is smallest integer data type?
(a) int
(b) short
(c) byte
(d) long
(c) byte
2. Which of the following is not a primitive data type ?
(a) int
(b) byte
(c) short
(d) enum
(d) enum
3. What is the size of int data type in java?
(a) 1 byte
(b) 2 bytes
(c) 4 bytes
(d) 8 bytes
(c) 4 bytes
4. Which is a valid float literal?
(a) 1.23
(b) 2
(c) 1.23f
(d) 1.23d
(c) 1.23f
5. Which of these are selection statements in Java?
(a) if
(b) for
(c) continue
(d) all of these
(a) if
6. Which of these is incorrect string literal?
(a) Hello World
(b) Hello\n World
(c) \Hello World
(d) Hello
(c) \Hello World
7. JVM is a/an _____________.
(a) compiler
(b) interpreter
(c) assembler
(d) Debugger
(b) interpreter
8. _____________ are reserved word that convey a special meaning to the compiler.
(a) identifier
(b) variable
(c) keyword
(d) constant
(c) keyword
9. Identifiers must not begin with a _____________.
(a) Upper case
(b) Digit
(c) Lower case
(d) Underscore
(b) Digit
10. Name of instance variables and public methods should start with a _____________.
(a) Upper case
(b) Digit
(c) Lower case
(d) Underscore
(c) Lower case
11. Name of all classes and interfaces start with a _____________.
(a) Upper case
(b) Digit
(c) Lower case
(d) Underscore
(a) Upper case
12. _____________ are data item whose value does not change during program execution.
(a) Variable
(b) Function
(c) Identifier
(d) Constant
(d) Constant
13._____________ is used to define a code for method and classes.
(a) ( )
(b) { }
(c) [ ]
(d) " "
(b) { }
14. _____________ is used for array declaration.
(a) ( )
(b) { }
(c) [ ]
(d) " "
(c) [ ]
15. _____________ is used for parameter in method definition, contains statements for condition etc.
(a) ( )
(b) { }
(c) [ ]
(d) " "
(a) ( )
16. _____________ are tokens that perform a specific task/computation when applied on variable or some other objects in an expression.
(a) Constatnt
(b) Datatype
(c) Variable
(d) Operator
(d) Operator
17. _____________ operator are used to assign the value of an expression to a variable.
(a) Relational
(b) Logical
(c) Assignment
(d) Bitwise
(c) Assignment
18. _____________ is the extension of java code files?
(a) .js
(b) .txt
(c) .class
(d) .java
(d) .java
19. _____________ is the extension of compiled java classes?
(a) .js
(b) .txt
(c) .class
(d) .java
(c) .class
20. Which of these packages contains the Scanner class in Java?
(a) java.io
(b) java.system
(c) java.lang
(d) java.util
(d) java.util
21. Which one of the following is not an access modifier?
(a) Protected
(b) Void
(c) Private
(d) Public
(b) Void
22.What is the numerical range of a char data type in Java?
(a) 0 to 256
(b) -128 to 127
(c) 0 to 65535
(d) 0 to 32767
(c) 0 to 65535
23.Which of the following is the default value of a boolean in Java?
(a)true
(b)false
(c)0
(d)null
(b)false
24.Which of the following is not a valid data type in Java?
(a)int
(b)float
(c)double
(d)real
(d)real
25.Which of the following is used to declare a constant variable in Java?
(a)constant
(b)final
(c)static
(d)immutable
(b) final
26.What is the size of the float data type in Java?
(a)16 bits
(b)32 bits
(c)64 bits
(d)128 bits
(b)32 bits
27.Which of the following is not a primitive data type in Java?
(a)int
(b)char
(c)String
(d)boolean
(c)String
28.Which of the following keyword is used to create a class in Java?
(a)class
(b)object
(c)type
(d)structure
(a)class
29.Which of the following statements is used to exit from a loop in Java?
(a)exit
(b)break
(c)stop
(d)end
(b)break
30.Which of the following statements is true about constructors in Java?
(a)A constructor can have a return type.
(b)A constructor is called when an object is created.
(c)A constructor can be inherited.
(d)Constructors cannot be overloaded.
(b)A constructor is called when an object is created.
31. Which of the following is a valid declaration of a method in Java?
(a) public void myMethod() {}
(b) public myMethod() {}
(c) public void myMethod() : {}
(d) void myMethod() {}
(a) public void myMethod() {}
32. Which of the following is used to import a package in Java?
(a) import packageName;
(b) import packageName.class;
(c) include packageName;
(d) using packageName;
(a) import packageName;
33. Which of the following is not a keyword in Java?
(a) static
(b) private
(c) package
(d) virtual
(d) v irtual
34. Which operator is used to compare two values in Java?
(a) =
(b) ==
(c) <>
(d) !==
(b) ==
35. Which of the following methods is used to convert a string to an integer in Java?
(a) toInt()
(b) parseInt()
(c) convertInt()
(d) Integer.parse()
(b) parseInt()
36. Which of the following is the correct way to create a new object in Java?
(a) MyClass obj = new MyClass();
(b) new MyClass() = obj;
(c) MyClass obj = MyClass();
(d) MyClass obj = new object();
(a) MyClass obj = new MyClass();
37. What does the term "polymorphism" in Java refer to?
(a) Multiple classes can have the same name.
(b) The ability of a class to inherit from multiple classes.
(c) The ability to use a single action in different ways.
(d) None of the above.
(c) The ability to use a single action in different ways.
38. Which of the following operators is used to access members of a class?
(a) .
(b) ::
(c) ->
(d) :
(a) .
39. Which of the following is not a valid Java identifier?
(a) _myVariable
(b) $amount
(c) 123abc
(d) my_variable
(c) 123abc
40. Which symbol is used for single-line comments in Java?
(a)
(b) /*
(c) ###
(d) //
(d) //