Objects
Objects
Multiple choice questions 10. Attributes that describe the object is:
(a) Information (b) method
1. Member variables are often called its _________, (c) data (d) name
and its member functions are referred to as its
11. Data attributes and behaviour methods
____________ in a class.
collectively is called
(a) attributes, methods (b) none of these
(a) Components (b) Associate
(c) values, morals (d) data, activities
(c) Part (d) Member
2. Keywords that are access specifiers
12. System which uses the concept of class that
(a) near and far (b) opened and closed
enables to express the set of objects that are
(c) table and row (d) private and public
abstractly equivalent differing only in the values
3. Use of __________ protects data from inadvertent
of their attributes?
modifications.
(a) Object oriented (b) Value oriented
(a) protect() member function
(c) Data oriented (d) All of these
(b) private access specifier
(c) class protection operator, @ 13. Element which can be considered as a blueprint
for various objects?
(d) none of these
4. Which other attribute can be use to distinguish, (a) Method (b) class
When two people have same name (c) object (d) member
(a) Colour (b) Name 14. What is a class for multiple objects with similar
(c) Birth date (d) Behavior features called?
5. How can we identify the value of attribute used ? (a) Image (b) representation
(a) Personality (b) Objects (c) template (d) guide
(c) Procedure (d) Identity 15. What things does a class describe with a group of
6. By whom the behavior is always associated? object and common behaviour?
(a) Personality (b) Objects (a) Features (b) attribute
(c) Procedure (d) Identity (c) values (d) States
7. Behavior of objects is called ? 16. Which element in the same class can share a
(a) Method (b) Technique common semantic purpose?
(c) Process (d) Procedure (a) Methods (b) classes
8. Property of object can be change due to its (c) objects (d) members
behavior ?
17. Name the concept which is used to embody all the
(a) State (b) Method
common features of a particular set of objects?
(c) Status (d) Class
(a) Method (b) class
9. To describe an object
(c) object (d) members
(a) What it is called (identity )
18. What represent a collection of classes ,constraints
(b) What it is (its state)
and relationship among classes?
(c) What it does (its behavior )
(a) Diagram (b) map
(d) All of these
(c) drawing (d) figure
19. How do we model the static view of an application? 30. Choose the correct address of memory location
(a) Diagram (b) map where only object is created for->
(c) drawing (d) figure Room r2= new RoomO :- variable R2
20. What do we call the variable which are of class (a) Memory (b) variable
type? (c) reference (d) none of these
(a) Orientation (b) position
Fill in the blanks
(c) reference (d) indication
21. Name the keyword that is used to create an object? 31. The class determines only the _________ of the
variables.
(a) Int (b) float
(a) types (b) collection
(c) new (d) real
(c) location (d) set
22. Identify that operator allocates the memory for
32. The actual __________ is contained inside the
an object and returns the address of the object for
individual objects and not in the class.
later use?
(a) information (b) data
(a) Int (b) Float
(c) collection (d) variables
(c) new (d) real
33. Every ________ has its own set of data.
23. The memory location where the object is stored is
(a) class (b) variable
known as?
(c) operator (d) object
(a) Memory (b) variable
34. ________ allocated different memory space to
(c) reference (d) none of these
hold their data values.
24. Name the special portion of memory where the (a) classes (b) variables
objects live?
(c) operators (d) objects
(a) heap (b) Pile
35. When ______ are no more needed the memory is
(c) stack (d) all of these claimed back to reuse.
25. When an object is created a special method is (a) classes (b) variables
executed to perform initial task what it is called? (c) operators (d) objects
(a) Function (b) constructor 36. In creating an object is also called ______
(c) class (d) method instantiation.
26. Which of the following is correct when an object (a) class (b) object
is created of type Room and assign its address to a (c) inheritance (d) polymorphism
variable r l 37. An ______ for an object is created by allocating
(a) rl=new room (); (b) rl=room () new; memory to store data for the object.
(c) RL= class room (); (d) None of these (a) instance (b) example
27. What is by default created, when there are empty (c) illustration (d) none of these
parentheses without arguments? 38. An object that belongs to a ________ is said to be
(a) Function (b) constructor an instance of that class
(c) class (d) method (a) cells (b) variables
28. What initialises the attributes (variables) of the (c) memory (d) class
object using default values? 39. And _______ of a class is another word for an
actual object.
(a) Function (b) constructor
(a) instance (b) example
(c) class (d) method
(c) memory (d) none of these
29. Which of the following contain arguments that
40. ______ is an abstract representation of an object
determine the initial values of variables?
where as an instance is its concrete representation
(a) Room (b) brackets
(a) cells (b) variables
(c) Parentheses (d) class
(c) memory (d) class
44. Match the columns:
Match the following
Group A Group B
41. Match the columns: 1. Declare class (i) class
variable
Group A Group B
2. Attributes and (ii) static
1. Instance and (i) methods
methods
Object
3. Passed by value (iii) methods
2. To define an (ii) OOP
4. Defined using (iv) parameters
object’s behavior
static keyword
3. Keyword for (iii) heap
(a) 1-(ii), 2-(i), 3-(iv), 4-(iii)
object
4. Instance allocated (iv) new (b) 1-(i), 2-(ii), 3-(iv), 4-(iii)
in memory (c) 1-(ii), 2-(i), 3-(iii), 4-(iv)
(a) 1-(ii), 2-(i), 3-(iv), 4-(iii) (d) 1-(ii), 2-(iv), 3-(i), 4-(iii)
45. Match the columns:
(b) 1-(i), 2-(ii), 3-(iv), 4-(iii)
Group A Group B
(c) 1-(ii), 2-(i), 3-(iii), 4-(iv)
1. Called without (i) overloaded
(d) 1-(ii), 2-(iv), 3-(i), 4-(iii) creating instance methods
42. Match the columns: 2. More than one (ii) class method
method having
Group A Group B
same name
1. Object Oriented (i) object
3. Invoked (iii) class
Programming
automatically
2. Unique entity (ii) data
4. methods are (iv) Constructor
3. Combining data (iii) inheritance
global
and methods
(a) 1-(ii), 2-(i), 3-(iv), 4-(iii)
4. Class acquires (iv) encapsulation
properties from (b) 1-(i), 2-(ii), 3-(iv), 4-(iii)
another class (c) 1-(ii), 2-(i), 3-(iii), 4-(iv)
(d) 1-(ii), 2-(iv), 3-(ii), 4-(iii)
(a) 1-(ii), 2-(i), 3-(iv), 4-(iii)
(b) 1-(i), 2-(ii), 3-(iv), 4-(iii) Programming based questions
(c) 1-(ii), 2-(i), 3-(iii), 4-(iv)
46. What is the use of constructor File Output Stream
(d) 1-(ii), 2-(iv), 3-(i), 4-(iii)
(a) File not found exception
43. Match the columns: (b) File out of bounds exception
Group A Group B (c) File found exception
1. Blue print (i) instantiating a (d) None of these
class 47. Which instance will be created from the following
2. Creating objects of (ii) class FileOutputStreamfosobject= new File Output
a class Stream (“/home/Akash/myfile.txt”);
3. Restricting the free (iii) fundamental (a) File output stream (b) File input stream
flow of data concept OOPS
(c) File reader screen (d) File constructor
4. Object (iv) encapsulation
48. What is the subclass of input stream and is
(a) 1-(ii), 2-(i), 3-(iv), 4-(iii) generally used to read byte data from the file.
(b) 1-(i), 2-(ii), 3-(iv), 4-(iii) (a) File input stream
(c) 1-(ii), 2-(i), 3-(iii), 4-(iv) (b) File reader screen
(c) File writer screen
(d) 1-(ii), 2-(iv), 3-(i), 4-(iii)
(d) File output stream
49. Name the method of file input stream class that Main obj = new Main();
reserve byte of data from this input stream. ystem.out.println(“The name is “ + obj.
S
(a) Void close () (b) Int read (byte [] b) name);
(c) Int read() (c) Void write() }
50. Identify the method of file input stream class }
that closes the file input stream and releases any (a) W
hat is the name of the constructor in the
system resources associated with the stream. above program
(a) Void close() (b) Int read (byte [] b) (i) Constructor
(c) Int read() (d) Void write() (ii) Main()
51. State the method of file input stream class that (iii) String[] args
reads up to b.length bytes of data from this (iv) Name
inputstream into an array of bytes
(b) What is variable in this program
(a) Void close() (b) Int read (byte [] b)
(i) Constructor
(c) Int read() (d) Void write()
(ii) Main()
52. Which of the following can get input from live
(iii) String[] args
interaction through keyboard/ GUI for it may
take input as command line arguments or from (iv) Name
the files. 57. Concerning the program code given below,
(a) Program (b) code answer the questions that follow:
Answers