0% found this document useful (0 votes)
11 views

r20 Oops Through Java Bit Bank

Uploaded by

mhys2827
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

r20 Oops Through Java Bit Bank

Uploaded by

mhys2827
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

SIDDHARTH INSTITUTE OF ENGINEERING & TECHNOLOGY:: PUTTUR

Siddarth Nagar, Narayanavanam Road –517583

QUESTIONBANK(OBJECTIVE)

Course & Branch: B.Tech – CSM, CAD & CAI Year & Sem: II-B. Tech & II-Sem
Subject with Code: Object Oriented Programming through Java (20CS0506)
Regulation: R20

UNIT-1

1. is the java file extension.. [A ]


A. .java B. c C. java D. cpp
2. Java follows principle. [C ]
A. ASCII B. Binary C. WORA D. None
3. Programming paradigm classified into types. [C ]
A. 1 B. 3 C. 2 D. 5
4. Java was developed by_ . [D ]
A. Dennisritche B. Kenthompson C. Bjarnestroustrup D.Jamesgosling
5. Object oriented programming language developed by . [A ]
A. Sun Microsystems B. Macintosh C. Oracle D. None
6. Java originally called as . [C ]
A. DBMS B. OS C. Oak D. None
7. Latest version of java . [D ]
A. JavaSE10 B. Java SE11 C. Java SE12 D. Java SE13
8. Java byte code is the code. [C ]
A. ASCII B. Secure C. Machine D. Assembler
9. . Hotspot provides compiler for bytecode. [D ]
A. JIT B. JAT C. JET D. A&B
10. What are object oriented features? [D ]
A. inheritance B. polymorphism C. Encapsulation D. All the three
11. Java does not support concepts.
[D ]
A. Structure B. Union C. Pointer D. All
12. is the instruction set for the Java Virtual. Machine
[A ]
A. Bytecode B. Binary C. Octal D. Decimal
13. What is the full form of JVM?
[C ]
B. java volatile C. Java Virtual
A. java variety machine D. None
machine Machine
14. New keyword is used to create
[C ]
A. Execution B. Compilation C. Memory D. All
________ is the process of hiding implementation from the user [A ]
15.
A. Data Abstraction B. object C. Inheritance D. Polymorphism
is the process by which one object aquires the
[C ]
16. property of other.

A. Abstraction B. Encapsulation C. Inheritance D. Polymorphism

[B ]
17. A function showing many forms is called .

A. Encapsulation B. Polymorphism C. Inheritance D. none


[B ]
18. Polymorphism derived from language.

A. France B. Greek C. Itally D. None


19. [A ]
A Java vararg is a____..
A. method B. constructor C.Inheritance D.polymorphism
[D ]
20. Long data type occupies how many bits in java.

A. 8 B. 16 C. 32 D. 64
[B ]
21 Character data type occupies how many bits in java

A. 8 B. 16 C. 32 D. 64
Float data type occupies how many bits in java. [C ]
22.

A. 8 B. 16 C. 32 D. 64
[A ]
23. Boolean data type occupies how many bits in java.

A. 1 B. 16 C. 32 D. 64
what are the primitive data types. [D ]
24
A. Integers C. Floating point D. Characters D. All
25. Type casting in java usually refers to___ [A ]
A. narrowing type B. widening type C. no type conversation D. None of the
conversations conversations above
26. What are the Type Conversions available in java language? [C ]
A. narrowing type
B. widening type C.A&B D. none of the
conversations
conversations above
27. Which of the following is a type of java Token___ [D ]
A. identifier B. keywords C. operators D. all of these
28. Java keywords also called as .. [C ]
A.Built in words B. reserved in words C. A&B D. none
29. How many keywords available in java [C ]
A. 32 B. 50 C. 51 D. 52
30. provides syntactic representation of Boolean, char, int or string data [B ]
A.keywords B. literals C.variables C. identifiers
31. what are the operators available in java. [D ]
A.arithmetic B. bitwise C. relational D. all
32. What are the java statements____ [D ]
A. selection B. iteration C. jump D. all
33. What is selection Statements? [C ]
A. if B. switch C. both A&B D. none
34. If you want to execute set of statements atleast once which loop you use [B ]

A. while B. do-while C. for D. enhanced for


35. .---- statement terminates a statement sequence in a Switch statement [A ]
A. break B. return C. goto D. continue
36. What is the jump statement in java? [D ]
A. break B. return C. continue D. A,B&C
37. Java Array is a Collection of____ [A ]
A. similar type of elements B. different type of C. hetrogenious data D. both A&C
elements
38. A Command line argument in java is a value passed at the time of_______ a program [B ]
A. compling B. Running C. A&B D. none of the
above
39. The command line arguments are passes at _____ [A ]
C. the time for D. None
A. runtime
B. Compile time
40. The Type of Arguments the MAIN Method accepts is_______ [D ]
A. integer[] B. float[] C. long[] D.string[]
UNIT-2

1. A class is declared by use of the keyword. [B ]


A. Object B. Class C. Inheritance D. All
2. The data, or variable, defined within a class are called . [D ]
A. Object B. Class C. Inheritance D. Instance
Variable
3. Java classes do not need to have a ___method. [D ]
A. Main() B. Static() C. A & B D. None
4. Which of the below syntax is correct to declare alternative arrays in java? [C ]
A. int[] a=new int(50); B. []int a=new int[10]; C. int[] a=new int[10]; D. int
a[]=new a[];
5. Which of the correct syntax to create an object of user class ‘Factorial’? [A ]
A. Factorial f=new B. Factorial f=new C. Factorial f; D. Factorial obj-
Factorial(); Factorial(10); >Factorial();
6. operator dynamically allocates memory for an object. [ ]
A. Dot B. Dot C. Calloc D. Malloc
7. A is a block of code which only runs when it is called. [B ]
A. Class B. Method C. Function D. Statement
8. Methods are used to perform certain actions, and they are also known as . [C ]
A. Class B. Method C. Function D. Statement
9. Method is defined with the name of the method, followed by . [A ]
A. Parentheses () B. Braces {} C. Brackets [] D. Semicolon
;
10. A __________in Java is a special method that is used to initialize objects. [B ]
A. Destructor B. Constructor C. Both A & B D. None

11. The constructor is called when an____ of a_________ is created. [C ]


A. Class ,Object B. Method
B. Method ,Class C.C.Object
,Class , Class
Object , Class D. Class, Method
operator to access the instance variables and then assigns values to them
12. [A ]
individually.
A. dot (.) B. comma (,) C. semicolon (;) D. None
13. __________to initialize each objects individually using statements.
[C ]
A. get Data B. Set Data C. Both A & B D. only A
14. _________is process of reclaiming the runtime unused memory automatically. [B ]
A. error B. Garbage Collection C. object collector D. Data collector
15. Garbage collector is performed So, java provides better memory management.
[D ]
A. Statically B. dynamically C. Finally D. Automatically
16. The keyword in java is used to restrict the user. [A ]
A. final B. static C. class D. all
17. If you make any method as final, you cannot ________ it.
[B ]
A.overload B. Override C. method D. extend
18. If you make any class as final, you cannot it. [B ]
A.overload B. Override C. method D. extend
19. Is final method inherited? [B ]
A. True B. False C. Only A D. Only B
20. A final variable that is not initialized at the time of declaration is known as variable. [A ]
A. blank final B. Empty final C. final variable D. all
21 Inheritance represents the IS-A relationship which is also known as a relationship. [B ]
A. child-parent B. parent-child C. parent D. child
22. Why use inheritance used in java? [A ]
A. Code Reusability B. recycle C. Inherit D. none
23. _____is a class which inherits the other class. [A ]
A. subclass B. base class C. derived class D. Super class
24 ____ is the class from where a subclass inherits the features. [D ]
A. subclass B. base class C. derived class D. Super class
25. Subclass also called as . [C ]
A. subclass B. base class C. derived class D. Super class
26. Subclass also called as ______________ . [C ]
A. subclass B. base class C. derived class D. Super class
27. If subclass (child class) has the same method as declared in the parent class, it is known as [B ]
A. method overloading B. method overriding C. method D. all
______is used to provide the specific implementation of a method which is already [B ]
28.
provided by its super class.
A. method overloading B. method overriding C. method D. all
29. Method overriding is used for runtime . [C ]
A. Encapsulation B. Inheritance C. polymorphism D. Class
30. The method must have the same name as in the parent class. [C ]
A. child-parent B. parent-child C. parent D. child
31. A class which is declared with the ________ keyword is known as an abstract class in java . [A ]
A. Abstract class B. final C. static D. extend
32. Abstract class can have _______ and _________ methods also. [B ]
A. class, object B. final, static C. static, constructor D. constructors,
static
A method which is declared as abstract and does not have implementation is known as an [A ]
33.
____.
A. Abstract method B. method overloading C. method overriding D. constructors,
method
34. Java ______ is a group of similar types of classes, interfaces and sub-packages. [B ]
A. interface B. package C. inheritance D. None
35. Java packages is used to categorize the ______ and _____ so that they can be easily maintained. [A ]
A. interface, class B. class, object C. class, interface D. None
36. Java package provides_______ . [D ]
A. access protection B. public protection C. private protection D. all
37. used to package from outside the package. [B ]
A. import java.io.*; B.
B.import
importpackage.*; B. import
package.*; C. import java.lang.*;
java. lang.*; C. None
38. Package inside the package is called the . [A ]
A. sub package B. super package C. parent package D. A&B
39. keyword used in the inheritance. [A ]
A. extends B. implements C. synchronized D. default
40. keyword used in the interface. [B ]
A. extends B. implements C. synchronized D. default

UNIT-3

Exception is an _______________ condition. [A ]


1.
A. abnormal B. normal C. A&B D. None
2. Java exception handling is managed via ________ keywords. [D ]
A. try B. catch, finally C. throw, throws D. All
3. Exception Handling is a mechanism to handle_________ errors. [A ]
A. run-time B. run-time C. execution-time
C. excution-time D. none
D. none
4. How many types of exceptions? [D ]
A. checked B. unchecked C. error D. All
5. Checked exceptions are checked at______. [A ]
A. Compile-time B. run-time C. execution-time
C. excution-time D. none
D. none
6. Unchecked exceptions are not checked at______. [B ]
A. Compile-time B. run-time C. execution-time
C. excution-time D. none
D. none
7. The ________ keyword is used to specify a block where we should place exception code. [A ]
A.try B. catch, finally C. throw, throws D. All
8. The block is used to handle the exception. [B ]
A.try B. catch C. throw D. All
9. The _______ block is used to execute the important code of the program. [C ]
A.try B. catch C. finally D. All
10. The keyword is used to throw an exception. [C ]
A.try B. catch C. throw D. All
11. The keyword is used to declare exceptions.
[C ]
A.try B. catch C. throws D. All
an exception is not caught, it is intercepted by a function called the______ exception
12. [D ]
handler.
A.try B. catch C. throws D. Uncaught
Java_______ block is used to handle the Exception by declaring the type of exception within
13. [B ]
the parameter.
A.try B. catch C. throws D. Uncaught
14. The catch block must be used after the_______ block only. [A ]
A.try B. catch C. throws D. Uncaught
The______ statement allows you to define a block of code to be tested for errors while it is
15. [B ]
being executed.
A. catch B. try C. throws D. Uncaught
16. The and keywords come in pairs.
[C ]
A. throws B. Throw C. try, catch D. All
17. Which of these is a super class of all errors and exceptions in the Java language? [B ]
A. run time error B. throw able C. catchable D. None of the
above
18. The built-in base class in Java, which is used to handle all exceptions is. [B ]
A. Raise B. Exception C. Error D. Throw able
19. When does Exceptions in Java arises in code sequence.
[A ]
A. Run Time B. Can Occur Any Time C. Compilation Time D. None
20. Which exception is thrown when divide by zero statement executes? [C ]
A. Number Format B. Null Pointer C. Arithmetic Exception D. None of these
Exception Exception
21 The try block within a try block is known as _________block in java. [A ]
A. nested try B. nested if C. nested if-else D. none of the
above
22. Throw able is an class in Java? [B ]
A. Abstract B. Interface C. Concrete D. None of the
above
23. Which Exception is belongs to Unchecked Exception? [D ]
A.IO Exception B. Interrupted C. EOF Exception D. Runtime
Exception Exception
24 The block is executed whether an exception is handled or not. [B ]
A. catch B. finally C. throw D. none
25. When does Exceptions in Java arises in code sequence? A
A. Run Time B. Compilation Time C. Can Occur Any Time D. None
26. Which of these keywords is not a part of exception handling? [C ]
A. try B. finally C. throw D. catch
27. Which of these keywords must be used to monitor for exceptions? [C ]
A. try B. finally C. catch D. throw
28. Which of these class is highest in hierarchy in java. [D ]
A. java. lang. Exception B. java. lang. Error C. java. lang. D. java. lang.
Throw able Object
29. Exception was introduced in which java version. [B ]
A. Java 1 B. Java 2 C. Java 3 D. Java 7
30. Exception is found in which package in java. [A ]
A. java. Lang B. java. util C. java.io D. java
31. Exception is a class/interface/abstract class/other? [A ]
A. Class B. Interface C. Abstract class D. Other
32. Which exception is thrown when divide by zero statement executes? [C ]
A. Number Format B. Null Pointer C. Arithmetic D. None of these
Exception Exception Exception
33. In which of the following package Exception class exist? [B ]
A. java. File B. java. lang C. java.io D. java. util
34. Which of these keywords is used to manually throw an exception? [B ]
A. try B. throw C. finally D. catch
35. This method returns actual cause of an exception. [B ]
A. init Cause B. get Cause() C. Set Cause() D. None of these
36. This method sets the cause for the calling exception. [A ]
A. init Cause B. get Cause() C. Set Cause() D. None of these
37. Exceptions allows to relate one exception with another exception. [C ]
A. IO Exception B. Arithmetic C. Chained D. All
38. Where cause is the exception that causes the current exception. [A ]
A. try B. finally C. catch D. Throw able
39. Which Exception is a Runtime Exception? [D ]
A. Arithmetic B. Illegal Argument C. Null Pointer D. A & B
What block is always executed, independently of a exception being [B ]
40.
raised?
A. throws B. finally C. catch D. Throw

UNIT-4

1. Which of these type parameters is used for a generic class to return and accept a number? [B ]
A. K B. N C. T D. V
2. Which of the following allows us to call generic methods as a normal method? [D ]
A. Type Interface B. Interface C. Inner class D. All of the
mentioned
3. Which of the following is Faster, String Builder or String Buffer? [A ]
A. String Builder B. String Buffer C. Both of the above D. None of the
above
4. Which of the following reference types cannot be generic? [A ]
A. Anonymous inner B. Interface C. Inner class D. All
Class
5. What is the default value of byte variable? [A ]
A. 0 B. 0.5 C. null D. undefined
6. Which of these types cannot be used to initiate a generic type? [C ]
A. Integer class B. Float Class C. Primitive Types D. Collections
7. Which of these is a correct way of defining of a generic method? [B ]
A. name(T1, T2, …, Tn) B. public name { /* … C .class name[T1, T2, D. name{T1, T2,
{ /* … */ } */ } …, Tn] { /* … */ } …, Tn} { /* … */ }

8. Which of these instances cannot be created? [B ]


A. Integer Instance B. Generic Class C. Generic Type D. Collection
Instance Instances
9. Which of the following cannot be Type parameterized? [D ]
A. Overloaded Methods B. Generic methods C. Class methods D. Overriding
methods
10. Generics are ____________ types [A ]
A. parameterized B. Nonparameterized C. Integer D. String
11. Generic entity means________ .
[D ]
A. class B. Interfaces C. Methods D. All
12. General form of Generics is ___ [B ]
A. class Test(T,U) B.class Test<T, U> C. class Test[T,U] D. All
13. Generic interface collection framework was designed to implement for achieving ______ [A ]
A. high-performance B. low-performance C. Dynamic- D. None
performance
14. The collection framework is contains______ of the following.
[D ]
A. classes B. interfaces C. Algorithms D. All
15. A generic array list implements Dynamic array by extending _________list. .
[B ]
A. 2 B. 3 C. 4 D. 5
16. Which method is used to write a byte to the current output stream?
[B ]
A.ONE B. TWO C.THREE D. FOUR
17. Java Streams are namely input stream and ____ stream.
[C ]
A. Stream B. Byte C. Output D. Character
18. The _____ stream reads data from the source (file, keyboard). [B ]
A. Stream B. Input C. Output D. Character
19. The ______ Stream writes data to the destination (File, output device) [C ]
A. Stream B. Input C. Output D. Character
20. _______ stream classes are a group of classes available in java.io package [A ]
A. Stream B. Input C. Output D. Character
21 Character streams classes can be used to read and write _______ Unicode characters . [B ]
A. 8 bits B. 16 bits C. 32 bits D. 64 bits
22. Which method is used to write a byte to the current output stream? [B ]
A. public void B. public void C. public void D. public void
write(int)throws IO write(byte[])throws IO flush()throws IO close()throws IO
Exception Exception Exception Exception
23 The _______ class is the subclass of input stream reader class. [A ]
A. File Reader B. File writer C. File Java D. Java file
24 Which of these class contains the methods used to write in a file? [D ]
A. File Stream B. File Input Stream C. Buffered Output D. File Buffer
Stream Stream
25. Which of these exception is thrown in cases when the file specified for writing is not found. [C ]
A. IO Exception B. File Exception C. File Not Found D. File Input
Exception Exception
26. Which of these methods are used to read in from file? [B ]
A. get() B. read() C. scan() D. read File
Input()
27. Which of these values is returned by read() method is end of file (EOF) is encountered? [C ]
A.0 B. 1 C. -1 D. Null
28. Which of these exception is thrown by close() and read() methods? [A ]
A.IO Exception B. File Exception C. File Not Found D. File Input
Exception Output Exception
29. Which of these methods is used to write() into a file? [C ]
A. put() B. put File() C. write() D. write File()
30. Which of these class is not a member class of java.io package? [D ]
A. File B. String Reader C. Writer D. String
31. Object Filter is a member of java.io package. [B ]
A. TRUE B. FALSE C. Can be true or false D. Can not say
32. ___________ returns true if called on a file and returns false when called on a directory. [C ]
A..Is File() B.Is file() C. is File() D. is file()
33. _____ classes are a group of classes designed to read characters from files. [B ]
A. Writer B. Reader C. Output D. Input
34. The _______ classes are a group of classes designed to write characters into a file [A ]
A. Writer B. Reader C. Character D. Byte
35. Writer classes are inherited from the _____ class. [B ]
A. Object B. Writer C. Reader D. Character
36. Writer class is the __________ for writing a character stream. [D ]
A. super class B. sub.io C. subclass D. base class
37. Method of _____________ class are used by its sub class . [A ]
A. Writer B. Object C. Reader D. Character
38. Can we perform file handling in Java by Java I/O API? [A ]
A. TRUE B. FALSE C. Can be true or false D. Cannot say
39. Which of these methods is used to write() into a file? [C ]
A. put() B. put File() C. write() D. write File()
40. Which of these class contains the methods used to write in a file? [A ]
A. File Stream B. File Input Stream C. Buffered D. File Buffer
Output Stream Stream

UNIT-5

Which is a component in AWT that can contain another component like buttons, text fields, [C ]
1.
labelsetc.
A. Window B. Container C. Panel D. Frame
2. What are the different types of controls in AWT? [D ]
A. Labels B.Push buttons C.Check boxes D. All ofThese
3. Give the abbreviation of AWT? [B ]
A.Applet Windowing B.Abstract Windowing C.Absolute Windowing D. None of the
Toolkit Toolkit Toolkit above

Which is the container that doesn't contain title bar and Menu Bars but it can have other [A ]
4.
components like button, text field etc.,
A. Window B. Frame C. Panel D. Container
5. The Swing Component classes that are used in Encapsulates a mutually exclusive set of buttons. [B ]
A. Abstract Button B. Button Group C. J Button D. Image Icon
6. Which package provides many event classes and Listener interfaces for even t handling? [C ]
A. java.awt B. java.awt. Graphics C. java.awt. event D. None
7. Name the class used to represent a GUI application window [D ]
A. Window B. Panel C. Dialog D. Frame
8. TousetheActionListener interface it must be implemented by a class [D ]
A.Creating a new class B. Using the class the C. An anonymous inner D.Allmentioned
graphical component class above
9. Which is used to stored at a and partial results? [C ]
A. Window B. Panel C. Frame D. Container
10. Which class provides many methods for graphics programming? [A ]
A. java.awt B. java. Graphics C. java. awt. Graphics D. None
11. By which method You can set or change the text in a Label? [A ]
A. set Text() B. get Text() C. Both A& B D. None
12. Which class can be used to represent a check box with a textual label that can appear in a menu
[C ]
A. Menu Bar B. Menu Item C. Check box Menu D. Menu
Item
13. It supports pluggable look and feel. It follows MVC (Model View Controller) architectue. [A ]
A. Swing B.AWT C. Both A& B D. None
The Java Foundation Classes (JFC) is a set of GUI components which simplify the
14. [A ]
development of desktop applications?
A.TRUE B.FALSE C. A&B D. None
15. How many types of controls do AWT supports these controls are subclasses of component? [B ]
A.7 B.6 C.5 D.8
16. Which are passive controls that do not support any interaction with the user? [C ]
A. Choice B. List C. Labels D. Checkbox
17. How many ways can we align the label in a container?
[D ]
A.1 B.2 C.3 D.4
18. The following way is used to create a frame is by creating the object of Frame class? [A ]
A. inheritance B. association C. Both A& B D. None
19. Which of the following classes are derived from the Component class.
[A ]
A. Container B. Window C. List D. Menu Item
20. Which of these is not a interface in the Collections Framework? [B ]
A. Collection B. Group C. Set D. List
21 Which of the following is correct about Java8? [D ]
A.Lambda Expression B. Method reference C. Default Method D. All the above
22. How will you call a default method of an interface in a class? [A ]
A.Using super keyword B.Using name of the C.Both of the above D.None of the
along with interface interface above
name.
23. Lambdas introduced in Java 8 allow us to treat . [B ]
A.Data as code B. Code as data C. All D. None
24 The newly introduced Streams API is available in which package of java 8 [C ]
A.java.io. streams B.java.io. stream C.java. util. streams D. java. util.
stream
Which class can be used Instead of System. Get Current Time Millis() to get a date and time in [A ]
25.
Java 8.
A.Clock B. Time C. Date D. Timer
26. Lambda expressions in java 8 are based on. [C ]
A.Procedure B. Data Programming C. Functional D. All
Programming Programming
27. how many methods are there in functional interface in Java 8? [B ]
A.0 B.1 C. 2 D. 3
28. In Java 8 Interfaces, methods can be [D ]
A.Default B. Abstract C. Interface D. all
29. Which package contains Date/Time (JSR 310) API in Java 8 [A ]
A.Java. time B. java. util. time C. java. Time date D. java. util.
calendar
30. Which is new command line tool for the Nash horn JavaScript engine in java 8 [C ]
A.jcs B.jfs C. jjs D. jss
31. Which of these represents a process that accepts one argument and produces a result [A ]
A.Functions B. Process C. Method D. Java
Functions
32. What can help us in avoiding Null Pointe Exceptions and null checks in java 8 [A ]
A.Optional B. Required C. Not Null D. Not Required
33. ode before Java 8 essentially used to be [B ]
A.Declarative B. Imperative C. Subjective D. None
34. What is Predicate in Java 8 [A ]
A.method B. class C. Interface D. Framework
35. Which is aggregate operation in Java 8 [A ]
A.filter B.map C.for Each D. All
36. Which method can be used to check null on an Optional variable in Java 8 [A ]
A.is Present( ) B. is Null able( ) C. is Presentable( ) D. is Not Null( )
37. Functional interfaces method is [B ]
A.static B. abstract C. final D. none
38. Which of these does Stream filter() operates on [A ]
A.Predicate B. Interface C. Class D. Methods
39. Which of these does for Each() operates on [B ]
A. Methods B. Consumer C. Procedure D. Predicate
40. In java 8 Function is ? [B ]
A.Class B. Interface C. Object D. Lambda
Expression

Prepared by: V.M VINAYAGAM, J. JERIN JOSE, K.MAHESWARI

You might also like