oOP Flashcards

1
Q

are the variables that each object (each instance of a class) has as part of itself.

A

instance variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

means they are accessible only to the object itself.

A

private,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

returns a reference to the object it constructs

A

constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Parameter names follow the same rules as the other names you might pick for a program. Names of this type are called

A

this

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

is a variable that holds part of the state of an object.

A

instance variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In Java, a characteristic of a class that is not part of its objects

A

static.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Can the static main() method invoke other static methods of the class?

A

Yes. Static methods can call other static methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Will parameter passing be the same as with the instance methods of the previous chapters?

A

Yes. Static methods pass data to other static methods through parameters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The program keeps looping until the user signals the end. What type of loop is this?

A

A sentinel controlled loop.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the parameter of the method that calculates factorial?

A

The value of N, an integer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the return value of the method that calculates factorial?

A

The factorial of N.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

is an incomplete version of a method that is used in place of the full method. Extremely useful when developing programs.

A

stub

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

let you test individual methods. This can be very useful.

A

unit testing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

is one whose data does not change.

A

immutable object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The arguments in a method call are often referred to as ____.

A

actual parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A(n) ____ method is a method that creates and initializes class objects.

A

constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

____ is the encapsulation of method details within a class.

A

Implementation hiding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

When a variable ceases to exist at the end of a method, programmers say the variable____.

A

goes out of scope

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Method names that begin with “____” and “set” are very typical.

A

get

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Public classes are accessible by all objects, which means that public classes can be

A

extend or/and used as a basis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Assigning ____to a field means that no other classes can access the field’s values.

A

private access

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Methods used with object instantiations are called ____ methods.

A

instance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Methods that retrieve values are called ____ methods.

A

accessors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

A(n) unique identifier is most likely used as a(n) ____ key in a database.

A

primary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

For ease in locating class methods, many programmers store them in ____ order.

A

alphabetical

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

A(n) ____ constructor is one that requires no arguments.

A

default

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

A(n) ____ is a program module that contains a series of statements that carry out a task.

A

method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

The method ____ is the first line of a method.

A

declaration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

executes first in an application, no matter where you physically place it within its class.

A

main method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Data items you use in a call to a method are called ____.

A

arguments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

A(n) ____ variable is known only within the boundaries of the method.

A

local

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

A(n) _____ causes a value to be sent from a called method back to the calling method.

A

return statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

An object is a(n) ____ of a class.

A

member

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

for a class, you no longer have access to the automatically created version.

A

when you write a constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

You are ____ required to write a constructor method for a class.

A

never

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

To execute a method, you ____________________ it from another method.

A

invoke

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

Access specifiers are also called access ____________________.

A

modifiers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

When you think in an object-oriented manner, everything is a(n) ____________________.

A

object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

A(n) ___________ is a number appended to a field, typically an ID number or account number.

A

check-digit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

so that other classes can instantiate objects that belong to the class.

A

You declare constructors to be object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

First line of a method

A

header

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

Combination of the method name and the number, types, and order of arguments

A

methods signature

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

Included within the method declaration parentheses

A

parameter type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

Are called class methods

A

static methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

Variables in the method declaration that accept the values from the actual parameters

A

formal parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

Used to return value back to the calling method

A

return statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

Data components of a class

A

instance variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

Application or class that instantiates objects of another prewritten class

A

class user

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

Variables you declare within a class, but outside of any method

A

data fields

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

a method that allows you to create objects from a class. You call the constructor by using the keyboard new, followed by the name of the class followed by any necessary parameter

A

Constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

A method that allows you to create objects from a class. you call the constructor by using the keyword new followed by the name of the class, followed by any necessary parameter

A

Constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

a method name followed by parenthesis Ex. calculate()

A

call

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

Value passed to a method

A

Argument

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

part of the method that receives data must the same type and in the same order as it is stated in the method declaration

A

Method parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

Blueprint in which objects are created

A

class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

initial requirement of the method. It is normally stated as part of the methods documentation.

A

Precondition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

Creating a new class based on a previously defined class

A

Inheritance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

Class that inherits from another class

A

Subclass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q

Has a name, parameter, and a return type, but no code in the body of the method.

A

Abstract Method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
Q

Class that contains one or more abstract methods. Abstract classes may not be instantiate, and require subclasses to provide implementation for the abstract methods

A

Abstract Class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
61
Q

Methods that stores a value in a field or in some other way changes the value of a field

A

Mutators

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
62
Q

Does not return a value

A

Void Method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
Q

Cause a methods to end and sends a value back to the statement that called the methods

A

return

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
64
Q

Two or more methods with the same name but different parameter types, order, and/ or number of parameters. When overloaded methods are called, the compiler decides which one to use based on the number, order, and type of parameter.

A

Method overloading

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
65
Q

Methods that gets a value from a class’s field, but does not change it

A

Accessors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
66
Q

Return the character at the specified index

A

char charAt(int index)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
67
Q

Returns number of characters in the string

A

int Length()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
68
Q

Return true if this string contains the same characters as str and false if it doesn’t. Ignores lower and upper case

A

boolean equalIgnore Case(String str)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
69
Q

Returns position of the first character in the first occurrence of str in this string

A

int indexOf(String str)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
70
Q

Returns new string that is the same except all letters are in lowercase

A

String toLower Case{}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
71
Q

returns - –uppercase

A

String toUpperCase()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
72
Q

Adds the specified string to the end of original string

A

-String concat(String str)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
73
Q

A(n) __ is a program module that contains a series of statements that carry out a task.

A

Methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
74
Q

the method__is the first line of a methods

A

Declaration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
75
Q

Executes first in application no matter where you physically place it within its class

A

Main Method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
76
Q

Data items you use in a call to a method are called

A

Arguments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
77
Q

____is the encapsulation of method details within a class

A

Implementation Hiding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
78
Q

A(n)___variable is known only within the boundaries of the methods

A
  • Local
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
79
Q

When a variable cease to exist st the end of a method, programmers say the variable____

A

-Goes out of scope

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
80
Q

The arguments in a methods call are often referred to as____

A

Actual Parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
81
Q

A(n)____causes a value to be ssent from a called method back to the calling metho

A

return statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
82
Q

an object is a(n) ___ of a class

A

-Member

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
83
Q

Methods names that begins with “___” and “set” are very typical

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
84
Q

Public classes are accessible by all objects, which means that public classes can be

A

Extend or / and used as a basis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
85
Q

Assigning ____ to a field means that no other classes can access the field’s values

A

Private access

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
86
Q

Methods used with objects intantiations are called _____methods

A

Instance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
87
Q

Methods that retrieve values are called _______methods

A

Accessors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
88
Q

A(n) unique identifier is most likely used as a(n) ____key in a database

A

Primary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
89
Q

A(n) _____methods is a methods that creates and initializes class objects

A

Constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
90
Q

For ease in locating class methods, many programmers stores them in ____ order.

A

Alphabetical

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
91
Q

A(n) ___ constructor is one that requires no arguments

A

Default

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
92
Q

You are ___required to write a constructor methods for a class

A

Never

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
93
Q

to execute a method, you ____it from another methods

A

Invoke

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
94
Q

Access specifiers are also called access___

A

Modifiers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
95
Q

When you think in an object-oriented manner, everything is a (n)____

A

Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
96
Q

A(n) ____ is a number appended to a field, typically an ID number or account number

A

Check digit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
97
Q

So that other classes can instantiate that belong to the class

A

You declare constructors to be object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
98
Q

First line of method

A

Header

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
99
Q

Combination of the methods name and the number, types, and order of arguments

A

Methods signature

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
100
Q

included with the methods declaration parantheses

A

Parameter type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
101
Q

Are called class methods

A

Static methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
102
Q

variables in the methods declaration that accept the values from the actual parameters

A

Formal statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
103
Q

used to return value back to calling method

A

return statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
104
Q

data components of a class

A

instance variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
105
Q

application or class that instantiate objects of another prewitten class

A

class user

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
106
Q

variables you declare within a class, but outside of any methods

A

data fields

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
107
Q

a group of characters separated by spaces

A

token

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
108
Q

preparing a disk file for reading

A

operating file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
109
Q

used to send characters to a text file

A

PrintWriter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
110
Q

data that is supplied to a method just before it starts running.

A

parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
111
Q
A

ArrayDemo.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
112
Q

3 Fundamental Features of OOP

A

1) encapsulation
2) inheritance
3) polymorphism

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
113
Q

an object-oriented technique in which the internal details of an object are “hidden” in order to simplify their use and reuse

A

encapsulation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
114
Q

a relationship between two classes in which one class ( the subclass) inherits all of the properties and capabilities of another ( the superclass)

A

inheritance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
115
Q

declaring a variable to have one type while it refers to an object of a subclass of that type

A

polymorphism

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
116
Q

a means of determining what aspects of a given problem can be viewed as objects in an eventual object-oriented design

A

object-oriented analysis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
117
Q

a software design method that models the characteristics of abstract or real objects using classes and objects.

A

object-oriented design

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
118
Q

a programming technique that features objects, classes, encapsulation, interfaces, polymorphism, and inheritance.

A

object-oriented programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
119
Q

degree to which responsibilities of a given component are a meaningful unit

A

cohesion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
120
Q

greater cohesion reflects better design; less coupling reflects better design.

A

cohesion vs coupling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
121
Q

degree to which one component must directly access the data of another component.

A

coupling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
122
Q

sets of responsibilities

A

roles

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
123
Q

they are the same when a given role is always played by the same object type

A

roles vs. objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
124
Q

3 Means of Object-Object Access

A

1) parameter passing
2) object declared in method
3) object is a member of another object through composition [subtype]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
125
Q

describes an inheritance relationship between two classes

A

is-a relationship

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
126
Q

the relationship demonstrated by a class that contains another class

A

has-a relationship

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
127
Q

implemented-in-terms-of relationship

A

uses-a relationship

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
128
Q

known as “class variables”, because there is only one unique value for all the objects of that same class

A

static members

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
129
Q

special reference that refers to the object in which it is used

A

this

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
130
Q

special reference that refers to the superclass of the object in which it is used

A

super

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
131
Q

Determine whether a subclass is a subtype

A

Liskov Substitution Principle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
132
Q

no outside classes can use this data field (except descendant classes), defeats the purpose of OOP

A

protected access

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
133
Q

type cast to the type of an ancestor class; usually done automatically

A

upcasting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
134
Q

type cast to the type of a descendant class; may cause runtime errors

A

downcasting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
135
Q

UML diagram that captures all actors (an individual or another system) and use cases involved with a system or product; Used to model user requirements

A

use case diagram

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
136
Q

a visual representation of the relationships between classes

A

class diagram

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
137
Q

represents real-world whole-part relationships

e.g., an engine is a part of a car

A

composition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
138
Q

represents a class as a collection or container of other classes

A

aggregation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
139
Q

used to show that some UML element or a set of elements requires, needs or depends on other model elements for specification or implementation

A

dependency

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
140
Q

minimum and maximum number of occurrences of one object for a single occurrence of related object

A

multiplicity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
141
Q

signifies the role that a participating entity type plays in each relationship instance. In some cases the same entity type participates more than once in a relationship type in different roles.

A

role name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
142
Q

a type of diagram that shows objects participating in interactions and the messages exchanged between them.

A

sequence diagram

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
143
Q

this pattern ensures you have at most one instance of a class in your application

A

singleton pattern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
144
Q

the design pattern that provides a way to access the elements of an aggregate object sequentially without exposing the underlying representation.

A

iterator pattern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
145
Q

the design pattern that translates one interface for a class into a compatible interface

A

adapter pattern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
146
Q
  • simplifies the interface of a group of classes,
  • hides the complexity of one or more classes behind a clean, well-lit facade,
  • makes an interface simple.
  • provides a unified interface to a set of interfaces in a subsystem
A

facade pattern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
147
Q

1) Determines the requirements of a system
2) Focus on what needs to be done (not how)
3) Carried out by a team of analysts
4) End product is a conceptual model

A

Object-Oriented Analysis Stage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
148
Q

1) Major subsystems should be loosely coupled, allowing independence
2) Many-to-many relationships require an additional class
3) Avoid exposing details of business logic implementation to the user interface
4) Avoid exporting mutable objects
5) Avoid importing objects of an internal type in the system

A

5 Design Principles

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
149
Q

aka “Single Dot Rule”

Long lists of method calls are attributed to bad design

A

Law of Demeter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
150
Q

Integer class is an example of Decorator pattern.

(a) True
(b) False

A

(a) True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
151
Q

In which of the following pattern an interface is responsible for creating a factory of related objects without explicitly specifying their classes?

(a) Factory Pattern
(b) Abstract Factory Pattern
(c) Singleton Pattern

A

(b) Abstract Factory Pattern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
152
Q

Which of the following describes the Structural pattern correctly?
(a) This type of patterns provide a way to create objects while hiding the creation logic, rather than instantiating objects directly using new operator

(b) This type of patterns concern class and object composition. Concept of inheritance is used to compose interfaces and define ways to compose objects to obtain new functionalities.
(c) This type of pattern are specifically concerned with communication between objects.

A

(b) This type of patterns concern class and object composition. Concept of inheritance is used to compose interfaces and define ways to compose objects to obtain new functionalities.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
153
Q

Which of the following is the correct list of entities of MVC pattern?

(a) Middle, Viewer, Controller
(b) Model, View, Control
(c) Model, Viewer, Control
(d) Model, View, Controller

A

(d) Model, View, Controller

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
154
Q

Define a family of algorithms, encapsulate each one, and make them interchangeable. It lets the algorithm vary independently from clients that use it.

(a) Decorator
(b) Composite
(c) Strategy

A

(c) Strategy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
155
Q

Which method must be defined by a class implementing the java.lang.Runnable interface?

(a) public void start()
(b) void notify()
(c) void run()
(d) none of these

A

(c) void run()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
156
Q

wait(), notify() & notifyAll() are methods of which class or interface? (a) Object

(b) Thread class
(c) Runnable interface
(d) None

A

(a) Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
157
Q

When start() method is called on thread it enters ______ state.

(a) running
(b) new
(c) waiting
(d) runnable

A

(d) runnable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
158
Q

What are the different ways of creating thread?

(a) Extending Thread class.
(b) Implementing Runnable interface
(c) Using Thread Executor framework ( thread pool)
(d) All of the above
(e) None of the above

A

(d) All of the above

159
Q

What is race condition in Java

(a) Two threads try to execute earlier form sort of race.
(b) Two or more threads can access shared data and they try to change it at the same time
(c) Race condition doesn’t allow two threads to access same resource

A

(b) Two or more threads can access shared data and they try to change it at the same time

160
Q

JUnit tests can be run automatically, and they check their own results and provide immediate feedback.

(a) True
(b) False

A

(a) True

161
Q

Which of the following annotation causes that Junit method run once after all tests have finished?

(a) @BeforeClass
(b) @AfterClass
(c) @Test
(d) @After

A

(b) @AfterClass

162
Q

What is the base class of nearly all Swing classes?

(a) Object
(b) Component
(c) JComponent
(d) Swing

A

(c) JComponent

163
Q

What is a container object in GUI programming?

(a) A container is another name for an array or vector.
(b) A container is any class that is made up of other classes.
(c) A container is a primitive variable that contains the actual data.
(d) A container is an object like a frame that has other GUI components placed inside of it.

A

(d) A container is an object like a frame that has other GUI components placed inside of it.

164
Q

When you create a JFame object it is not automatically displayed. (a) True
(b) False

A

(a) True

165
Q

Which of the following are false about Collections and Collection? (a) Collections is a utility class

(b) Collection is an interface to Set and List
(c) Collections is a special type of collection which holds Set of collections
(d) Both Collections and Collection entity belongs to java.util package.

A

(c) Collections is a special type of collection which holds Set of collections

166
Q

Which of the following is false about collections in Java?

(a) List, Map and Set are interfaces.
(b) java.util is the default package for collection classes.
(c) Collection interface is the base interface.
(d) List, Map and Set are abstract classes

A

(d) List, Map and Set are abstract classes

167
Q

What is it called when a program is written to respond to the button clicks, menu selections, and other actions of the user in whatever order the user does them?

(a) Event-driven programming.
(b) Action-driven programming.
(c) User-driven programming.
(d) Mouse-driven programming

A

(a) Event-driven programming.

168
Q

What is the name for a method that responds to events?

(a) A container method.
(b) A listener method.
(c) A snoop method.
(d) An application method

A

(b) A listener method.

169
Q

. Which of the following methods can be used to draw the outline of a square within a java.awt.Component object?

  1. fillRect()
  2. drawLine()
  3. drawRect()
  4. drawString()
  5. drawPolygon()

(a) 2 and 3
(b) 1,2, and 3
(c) 2,3, and 5
(d) 3,4, and 5.

A

(c) 2,3, and 5

170
Q

A class is divided into which of these compartments?

a. Name Compartment
b. Attribute Compartment
c. Operation Compartment
d. All of the above

A

d. All of the above

171
Q

What is multiplicity for an association?

a. The multiplicity at the target class end of an association is the number of instances that can be associated with a single instance of source class
b. The multiplicity at the target class end of an association is the number of instances that can be associated with a number instance of source class
c. a) and b)
d. None of the above

A

a. The multiplicity at the target class end of an association is the number of instances that can be associated with a single instance of source class

172
Q

Which of these are the heuristics?

a. Name classes, attributes, and roles with noun phrases
b. Name operations and associations with verb phrases
c. Stick to binary associations
d. All of the above

A

d. All of the above

173
Q

Use case descriptions consists of interaction among which of the following?

a. Products
b. Actors
c. Products & Actors
d. Usecases

A

c. Products & Actor

174
Q

Use case description contents includes? a. Use case name and number b. Actors c. Stakeholder and needs d. All the above

A

d. All the above

175
Q

Use case diagram and sequence diagram are considered as types of

a. non-behavioral diagrams
b. behavioral diagrams
c. non structural diagrams
d. structural diagrams

A

b. behavioral diagrams

176
Q

Which of the following is NOT a tool that can be used for discovering class behaviors and responsibilities? a. CRC cards b. interface c. sequence diagram d. none of the above

A

b. interface

177
Q

In which of the following relationships, does the whole have a responsibility for the part, and is usually shown with a filled-in diamond?

a. Whole/part
b. Composition
c. Aggregation
d. Association

A

b. Composition

178
Q

Which diagram models the life cycle of a single object?

a. Sequence diagram
b. Use case diagram
c. State machine diagram
d. None of the above

A

c. State machine diagram

179
Q

Indicate if the statement is true or false based on the UML diagram below: “This web service is used by any number of users” a. True
b. False

A

a. True

180
Q

Which of these can be used to fully abstract a class from its implementation?

(a) Objects
(b) Packages
(c) Interfaces
(d) None of the Mentioned.

A

(c) Interfaces

181
Q

In Java, a class may have _superclass(es) and implement ___interface(s)

(a) only one / only one
(b) multiple / only one
(c) only one / multiple
(d) multiple / multiple

A

(c) only one / multiple

182
Q

What is the correct syntax for defining a new class Parakeet based on the superclass Bird?

(a) class Parakeet is-a Bird{ }
(b) class Bird defines Parakeet{ }
(c) class Bird has-a Parakeet{ }
(d) class Parakeet extends Bird{ }

A

(d) class Parakeet extends Bird{ }

183
Q

The private members of a superclass can be accessed by a subclass.

(a) True
(b) False

A

(b) False

184
Q

You can instantiate an object of a subclass of an abstract class, but only if the subclass gives the definitions of all the abstract methods of the superclass.

(a) True
(b) False

A

(a) True

185
Q

The method toString() is a public member of the class ____.

(a) Object
(b) String
(c) Writer
(d) Output

A

(a) Object

186
Q

An abstract method ____.

(a) is any method in the abstract class
(b) cannot be inherited
(c) has no body
(d) is found in a subclass and overrides methods in a superclass using the reserved word abstract

A

(c) has no bod

187
Q

If class Dog has a subclass Retriever, which of the following is true?

(a) Because of single inheritance, Dog can have no other subclasses.
(b) Because of single inheritance, Retriever can extend no other class except Dog.
(c) The relationship between these classes implies that Dog “is-a” Retriever.
(d) The relationship between these classes implies that Retriever “has-a” Dog.

A

(b) Because of single inheritance, Retriever can extend no other class except Dog.

188
Q

Which of the following statement about Java is FALSE?

(a) All objects are dynamically allocated.
(b) Every function (method) must belong to a class.
(c) It uses garbage collection to deallocate dynamically allocated objects.
(d) ArrayList elements can be primitive types or objects.

A

(d) ArrayList elements can be primitive types or objects.

189
Q

In Java, you can automatically make a reference variable of a subclass type point to an object of its superclass.

(a) True
(b) False

A

(b) False

190
Q

Reuse of code (e.g. Visual Basic, JavaBean)

A

Software Components

191
Q

Reuse of “plug-in” code (e.g. Java Swing)

A

Frameworks

192
Q

Reuse of Design

A

Design Paterns

193
Q

is a sequence of values of the same type. They can hold both primitives and objects.

A

array

194
Q

What field returns the number of elements in an array?

A

The length field. It is an instance variable of the array.

194
Q

Syntax for array element access

A

arrayReference[index]

Ex. data[2]

195
Q

Syntax for initializing an array

A

typeName[] arrayReference = new typeName[length]

Ex. double[] data = new double[10];

196
Q

How do you access the last index of an array?

A

arrayReference[length - 1]

197
Q

Initialize an integer array named primes with five values.

A

int[] primes = new int[] { 2, 3, 5, 7, 11 };

198
Q

using a method on an uninitialized object will cause a ___________. Unchecked.

A

NullPointerException

199
Q

Each object is a distinct individual

A

Identity

200
Q

has a various properties, which might change

A

State

201
Q

It can do thing and can have things done to is

A

Behavior

202
Q

A description of a kind of object

A

Class

203
Q

Creating an object

A

Instantiation

204
Q

a characteristic of a class that is not shared by its objects

A

Static

205
Q

the method that belongs to a class definition

A

Static Method

206
Q

this means that after construction, they cannot be altered

A

String Objects are immutable

207
Q

Is constructed out a block of main memory and hence has a unique location

A

Object

208
Q

Is constructed out a block of main memory and hence has a unique location

A

Object

209
Q

Describe the location in memory of a particular object

A

Object reference

210
Q

Does not contain the actual object, just how to find it.

A

Reference Variable

211
Q

Is the correct term for objects that are not referred to by any referred to by any reference variable

A

Garbage

212
Q

Reclaims the last objects so that the memory they are made of can be used again.

A

Garbage collector

213
Q

are sometimes called variable

A

field

214
Q

Is a request to run a method of an object

A

Method call

215
Q

Used to specify which object, and what method of that object run

A

Dot notation

216
Q

the programmer ask for values to be converted with a type cast

A

Explicitly

217
Q

If the compiler can make the conversion without loss of information, or with only a small loss of precision, it will automatically do so.

A

Implicitly

217
Q

If the compiler can make the conversion without loss of information, or with only a small loss of precision, it will automatically do so.

A

Implicitly

218
Q

Means that some of the less significant digit may become zeros, but the most important digits and the size of the size of the number will remain

A

Less of precision

219
Q

Are very useful and are frequently used

A

String Object

220
Q

Is a special value that means “no object”

A

Null

221
Q

A string object that contains no characters is still an object

A

Empty String

222
Q

Sometimes immutable objects are called

A

write-once

223
Q

the concat method performs

A

String concatenation

224
Q

When an operator such as + changes meaning depending on its argument, it is said to be

A

Overloaded

225
Q

the stage where the compiled program is running

A

Run Time

226
Q

used to hand back a value to the caller

A

Return statement

227
Q

is the type of value that method hands back to the caller of the method.

A

Return type

228
Q

is automatically supplied by the java compiler

A

Default Constructor

229
Q

is a list of values and their types

A

Parameter list

230
Q

class that contains main()

A

Driver

231
Q

is a variable that holds part of the state of an object

A

Instance Variable

232
Q

Variable that are object(each instance of a class) has a part of itself

A

Instance Variable

233
Q

is the type of one item of data that will be handed to the constructor

A

Data Type

234
Q

Is a name that is used for that item of data

A

Parameter Name

235
Q

to show when an identifier refers to an objects instance variable

A

This

236
Q

is an identifier picked by the programmer

A

Method name

237
Q

is the method name and parameter list

A

Signiture of a method

238
Q

a method that changes the state of an object

A

Mutator / setter

239
Q

a method that returns a value from an instance variable

A

Access method/ getter

240
Q

Decide what checking account object do and what data they hold

A

requirement analysis

241
Q

the compiler puts in a toString() method even if you did not write

A

Inheriance

242
Q

recall that there can be more than one reference to a given object. Each reference is called

A

alias

243
Q

using a method on an uninitialized object will cause a ___________. Unchecked.

A

NullPointerException

244
Q

situation when use to exceptions.

A

Accessing Data Files, User input

245
Q

These exceptions are always Unchecked

A

Runtime Exceptions

246
Q

Class is in the java.lang package

A

Throwable

247
Q

Class extends the Object class

A

Throwable

248
Q

Class implements the Serializable Inteface

A

Throwable

249
Q

Used for launching an exception.

A

throw new

250
Q

User has entered invalid data

A

Exceptions Best Practice

251
Q

A file that needs to be opened cannot be found

A

Exceptions Best Practice

252
Q

Network connection has been lost in the middle of communication.

A

Exceptions Best Practice

253
Q

JVM has run out of memory

A

Exceptions Best Practice

254
Q

Class includes the bytesTransferred filed that provides information on how many bytes were transferred successfully before the interruption occurred

A

InterruptedIOException

255
Q

This classes can be thrown

A

Exception()

256
Q

This classes can be thrown

A

Throwable()

257
Q

This classes can be thrown

A

Error()

258
Q

This classes can be thrown

A

RuntimeException()

259
Q

Has the fewest subclasses when compared to Exception and RuntimeException Classes.

A

Error Class

260
Q

SuperClass of Error Exceptions, Subclass of VirtualMachineError. Constructors accept String argument or no argument.

A

Internal Error

261
Q

SuperClass of Error Exceptions, Subclass of VirtualMachineError. Constructors accept String argument or no argument.

A

OutOfMemoryError

262
Q

SuperClass of Error Exceptions, Subclass of VirtualMachineError. Constructors accept String argument or no argument.

A

StackOverflowError

263
Q

SuperClass of Error Exceptions, Subclass of VirtualMachineError. Constructors accept String argument or no argument.

A

UnknownError

264
Q

This class does not have a no argument constructor

A

IIOException

265
Q

Used for logging unexpected behavior

A

Java Exception Mechanism

266
Q

Used to determine what to do when something unexpected happens.

A

Java Exception Mechanism

267
Q

Standard Java exception class

A

java.lang.SecurtiyException

268
Q

Standard Java exception class

A

java.io.FileNotFoundException

269
Q

Improves code because error handling code is clearly separated from main program logic.

A

Java Exception Mechanism

270
Q

Allows creation of new exceptions that are custom to a particular application domain.

A

Java Exception Mechanism

270
Q

Allows creation of new exceptions that are custom to a particular application domain.

A

Java Exception Mechanism

271
Q

Can declare that it throws a checked exception

A

Main Method Exception

272
Q

Exception can throw instances of any subclass of that exception class.

A

Exception Classes

273
Q

Can not be reached in the catch block.

A

try block variables

274
Q

IllegalStateException

A

Application

275
Q

IllegalArgumentException

A

Application

276
Q

ClassCastException
NullPointerException
SecurityException

A

JVM

277
Q

What is the process of defining more than one method in a class differentiated by parameters?

a) Function overriding
b) Function overloading
c) Function doubling
d) None of these

A

b

278
Q

Which of these can be used to diffrentiate two or more methods having same name?

a) Parameters data type
b) Number of parameters
c) Return type of method
d) All of the mentioned

A

d

279
Q

What is the output of this program?

class box {
int width;
int height;
int length;
int volume;
void volume(int height, int length, int width) {
volume = width height length;
}
}
class Prameterized_method{
public static void main(String args[]) {
box obj = new box();
obj.height = 1;
obj.length = 5;
obj.width = 5;
obj.volume(3, 2, 1);
System.out.println(obj.volume);
}
}
a) 0
b) 1
c) 6
d) 25
A

c

280
Q

Which of these data tupe can be used for a method having a return statement in it?

a) void
b) int
c) float
d) All of the mentioned

A

d

281
Q

What is the output of this program?

class equality {
int x;
int y;
boolean isequal(){
return(x == y);
}
}
class Output {
public static void main(String args[]) {
equality obj = new equality();
obj.x = 5;
obj.y = 5;
System.out.println(obj.isequal);
}
}
a) false
b) true
c) 0
d) 1
A

b

282
Q

What is the output of this program?

class box {
int width;
int height;
int length;
int volume;
void volume() {
volume = width height length;
}
void volume(int x) {
volume = x;
}
}
class Output {
public static void main(String args[]) {
box obj = new box();
obj.height = 1;
obj.length = 5;
obj.width = 5;
obj.volume(5);
System.out.println(obj.volume);
}
}
a) 0
b) 5
c) 25
d) 26
A

b

283
Q
What is the output of this program?
class Output {
static void main(String args[])
{
int x , y = 1;
x = 10;
if(x != 10 && x / 0 == 0)
System.out.println(y);
else
System.out.println(++y);
}
}
a) 1
b) 2
c) Runtime Error
d) Compilation Error
A

d

284
Q

What is the output of this program?

class area {
int width;
int length;
int volume;
area() {
width = 5;
length = 6;
}
void volume() {
volume = width height length;
}
}
class cons_method {
public static void main(String args[]) {
area obj = new area();
obj.volume();
System.out.println(obj.volume);
}
}
a) 0
b) 1
c) 25
d) 30
A

d

285
Q

When does Exceptions in Java arises in code sequence?

a) Run Time
b) Compilation Time
c) Can Occur Any Time
d) None of the mentioned

A

a

286
Q

Which of these keywords is not a part of exception handling?

a) try
b) finally
c) thrown
d) catch

A

c

287
Q

Which of these keywords must be used to monitor for exceptions?

a) try
b) finally
c) throw
d) catch

A

a

288
Q

Which of these keywords must be used to handle the exception thrown by try block in some rational manner?

a) try
b) finally
c) throw
d) catch

A

d

289
Q

Which of these keywords is used to manually throw an exception?

a) try
b) finally
c) throw
d) catch

A

c

290
Q

What is the output of this program?

class exception_handling {
public static void main(String args[]) {
try {
System.out.print("Hello" + " " + 1 / 0);
}
catch(ArithmeticException e) {
System.out.print("World");
}
}
}
a) Hello
b) World
c) HelloWorld
d) Hello World
A

b

291
Q

What is the output of this program?

class exception_handling {
public static void main(String args[]) {
try {
int a, b;
b = 0;
a = 5 / b;
System.out.print("A");
}
catch(ArithmeticException e) {
System.out.print("B");
}
}
}
a) A
b) B
c) Compilation Error
d) Runtime Error
A

b

292
Q
}
}
a) Hello
b) World
c) HelloWorld
d) Hello World
b

What is the output of this program?

class exception_handling {
public static void main(String args[]) {
try {
int a, b;
b = 0;
a = 5 / b;
System.out.print("A");
}
catch(ArithmeticException e) {
System.out.print("B");
}
}
}
a) A
b) B
c) Compilation Error
d) Runtime Error
b

What is the output of this program?

class exception_handling {
public static void main(String args[]) {
try {
int a, b;
b = 0;
a = 5 / b;
System.out.print("A");
}
catch(ArithmeticException e) {
System.out.print("B");
}
finally {
System.out.print("C");
}
}
}
a) A
b) B
c) AC
d) BC
A

d

292
Q
}
}
a) Hello
b) World
c) HelloWorld
d) Hello World
b

What is the output of this program?

class exception_handling {
public static void main(String args[]) {
try {
int a, b;
b = 0;
a = 5 / b;
System.out.print("A");
}
catch(ArithmeticException e) {
System.out.print("B");
}
}
}
a) A
b) B
c) Compilation Error
d) Runtime Error
b

What is the output of this program?

class exception_handling {
public static void main(String args[]) {
try {
int a, b;
b = 0;
a = 5 / b;
System.out.print("A");
}
catch(ArithmeticException e) {
System.out.print("B");
}
finally {
System.out.print("C");
}
}
}
a) A
b) B
c) AC
d) BC
A

d

293
Q
What is the output of this program?
class exception_handling {
public static void main(String args[]) {
try {
int i, sum;
sum = 10;
for (i = -1; i < 3 ;++i)
sum = (sum / i);
}
catch(ArithmeticException e) {
System.out.print("0");
}
System.out.print(sum);
}
}
a) 0
b) 05
c) Compilation Error
d) Runtime Error
A

c

294
Q

What is the output of this program?

class exception_handling {
public static void main(String args[]) {
try {
int i, sum;
sum = 10;
for (i = -1; i < 3 ;++i) {
sum = (sum / i);
System.out.print(i);
}
}
catch(ArithmeticException e) {
System.out.print("0");
}
}
}
a) -1
b) 0
c) -10
d) -101
A

c

295
Q

Which of these is a super class of all exceptional type classes?

a) String
b) RuntimeExceptions
c) Throwable
d) Cachable

A

c

296
Q

Which of these class is related to all the exceptions that can be caught by using catch?

a) Error
b) Exception
c) RuntimeExecption
d) All of the mentioned

A

b

297
Q

Recu____ the technique of making a function call itself. This technique provides a way to break complicated problems down into simple problems which are easier to solve.
Recu____ may be a bit difficult to understand. The best way to figure out how it works is to experiment with it

A

Java recursion

298
Q

Adding two numbers together is easy to do, but adding a range of numbers is more complicated. In the following example, recursion is used to add a range of numbers together by breaking it down into the simple task of adding two numbers:
Use recursion to add all of the numbers up to 10.

public class MyClass {
public static void main(String[] args) {
int result = sum(10);
System.out.println(result);
}
public static int sum(int k) {
if (k > 0) {
return k + sum(k - 1);
} else {
return 0;
}
}
}
A

Recursion continued

299
Q

Example Explained
When the sum() function is called, it adds parameter k to the sum of all numbers smaller than k and returns the result. When k becomes 0, the function just returns 0. When running, the program follows these steps:

10 + sum(9)
10 + ( 9 + sum(8) )
10 + ( 9 + ( 8 + sum(7) ) )

10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 + sum(0)
10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0

Since the function does not call itself when k is 0, the program stops there and returns the result.

A

Recursion continued part 2

300
Q

Just as loops can run into the problem of infinite looping, recursive functions can run into the problem of infinite recursion. Infinite recursion is when the function never stops calling itself. Every recursive function should have a halting condition, which is the condition where the function stops calling itself. In the previous example, the halting condition is when the parameter k becomes 0.
It is helpful to see a variety of different examples to better understand the concept. In this example, the function adds a range of numbers between a start and an end. The halting condition for this recursive function is when end is not greater than start:

A

Halting condition

301
Q

Use recursion to add all of the numbers between 5 to 10.

public class MyClass {
public static void main(String[] args) {
int result = sum(5, 10);
System.out.println(result);
}
public static int sum(int start, int end) {
if (end > start) {
return end + sum(start, end - 1);
} else {
return end;
}
}
}
A

Halting condition continued

302
Q

the ___ package contains frequently used classes and is implicity imported into java program.

A

java.lang

303
Q

defienes the circumstances under which a class can be accessed and the other classes that have the right to use a class

A

access specifier

304
Q

an indefinite loop

A

event - controlled

305
Q

requires three expressions separated with a question mark and a colon

A

conditional operator

306
Q

describes the feature of language that allows the same word to be interpreted correctly in different situations based on the content

A

polymorphism

307
Q

another name for a nonstatic member class

A

inner class

308
Q

statement is the decision structure you use when you need to take other of the two possible course of action

A

dual alternative if

309
Q

programs that are embedded in a web page

A

java applets

310
Q

is the type to which all operands in an expression are converted so that they are compatible with each other

A

unifying type

311
Q

refers to the order in which values are used with operators

A

associativity

312
Q

are also called modules, methods, function, and subroutines

A

producers

313
Q

the reference to an object that is passed to any object’s nonstatic method

A

this reference

314
Q

you can use ___ arguments to initialize field values, but you can also use arguments for any other purpose

A

constructor

315
Q

is the process of ensuring that a value falls within a specified range

A

validating data

316
Q

loop_____ is the technique of combining two loops into one

A

fusion

317
Q

the order of the conditional expressions in the following is most important within a(n) ____ loop

A

nested

318
Q

a(n)____ loop is an indefinite loop in which the number of execution is determined by user actions

A

event - controlled

319
Q

a(n) ____ loop is one that performs no actions other than looping

A

do-nothing

320
Q

one execution of any loop

A

iteration

321
Q

the modulus operator (%) is a _____operator

A

Binary

322
Q

a value that stops the loop

A

sentinel

323
Q

a loop controlled by the user is a type of _____loop

A

incrementing

324
Q

is the first input statement prior to a loop that will execute a subsequent input statement for the same variable

A

Priming read

325
Q

Before entering a loop, the first input statement, or ___, is retrieved

A

Priming read

326
Q

the prefix that is a ____operator

A

Unary

327
Q

the process of repeating increasing a value by some amount

A

Accumulating

328
Q

is used for mean in java

A

final

329
Q

is used as a return value to flag an error

A

ERRORFLAG

330
Q

is data that is supplied to a method just before it starts running.

A

Parameter

331
Q

when they have the same name but different types or numbers of parameters. The compiler will inspect the parameters of a method call and pick the method that best matches the parameter list.

A

overloaded methods

332
Q

Do you think that this method should print out an error message when it detects an error?

A

yes

333
Q

what types of data can arrays hold in their cells?

A

Any type of data at all:

334
Q

What is the name of the parameter passing mechanism that Java uses?

A

Call by Value.

335
Q

the programmer ask for values to be converted with a type cast

A

Explicitly

336
Q

if the compiler can make the conversion without less of information or with only a small less of precision, it will automatically do so.

A

Implicitly

337
Q

means that some of the less significant digit may become zeros but the most important digits and the size of the size of the number will remain

A

Less precision

338
Q

is a name that is used for that item of data

A

parameter name

339
Q

is the method name and parameter list

A

signiture of a method

340
Q

a method that changes the state of an object

A

Mutator method

341
Q

a method that changes the state of an object

A

Mutator/Setter

342
Q

a method that returns a value from an instance variable

A

Access method / Getter

343
Q

when an object’s instance variables are visible only to the subject’s own methods.

A

Encapsulation

344
Q

can be used only by the other methods of the objects

A

Private Method

345
Q

a group of related classes

A

Package

345
Q

a group of related classes

A

Package

346
Q

is a value that is sent to a method when it is called

A

Parameter

347
Q

is a name used for a class a variable or a parameter

A

Identifier

348
Q

are bound to an actual value only as long as their method is active

A

Formal Parameter

349
Q

the section of source code that can see the parameter

A

Scope of a formal parameter

350
Q

is a variable that is declared inside of the body of a method

A

Local Variable

351
Q

short from where it is declared and ends at the end of the body of a method

A

Scope of local variable

352
Q

the identifier used in a method to sand for the value that will be passed into the method by a caller

A

Formal Parameter

353
Q

the actual value that is passed

A

Actual Parameter

354
Q

the type of parameter passing that java uses

A

call by value

355
Q

is part of an object of the type describe by the class

A

Instance Variable

356
Q

a variable whos scope extends over the entire program

A

Global Variable

357
Q

is an object that is used to share a list of values

A

arrays

358
Q

an array is made out of a contiguous block of memory that is divided into a number of

A

cell

359
Q

an expression such as data[3]

A

Subscripted variable

360
Q

a java program is running, each time an array index is used it is checked to be sure that it is ok

A

Bounds Checking

361
Q

The words on the command line after the name of the program

A

command line arguments

362
Q

an array that uses a single substription

A

One dimensional array

363
Q

requires two indexes to access values

A

two dimensional array

364
Q

a systematic procedure used to compute something

A

Algorithm

365
Q

How can a program tell how many command line arguments it has been given?

A

Use args.length

366
Q

Are the data in a list always processed in order?

A

No.

367
Q

Can the linear search algorithm be used on a partially full array?

A

Yes, of course. You need to watch out for nulls, though.

368
Q

used to postpone the handling of a checked exception

A

throws

369
Q

is used to invoke an exception explicitly.

A

throw

370
Q

Which exceptions needs to be declared

A

only checked exception

371
Q

Which of these class is related to all the exceptions that cannot be caught?

a) Error
b) Exception
c) RuntimeExecption
d) All of the mentioned

A

a) Error

372
Q

Which of these handles the exception when no catch is used?

a) Default handler
b) finally
c) throw handler
d) Java run time system

A

a) Default handler

373
Q

Which of these keywords is used to generate an exception explicitly?

a) try
b) finally
c) throw
d) catch

A

c) throw

374
Q

Which of these class is related to all the exceptions that are explicitly thrown?

a) Error
b) Exception
c) Throwable
d) Throw

A

c) Throwable

374
Q

Which of these class is related to all the exceptions that are explicitly thrown?

a) Error
b) Exception
c) Throwable
d) Throw

A

c) Throwable

375
Q

Which of these class is related to all the exceptions that are explicitly thrown?

a) Error
b) Exception
c) Throwable
d) Throw

A

c) Throwable

376
Q

Which of these operator is used to generate an instance of an exception than can be thrown by using throw?

a) new
b) malloc
c) alloc
d) thrown

A

a) new

377
Q

Which of these handles the exception when no catch is used?

a) Default handler
b) finally
c) throw handler
d) Java run time system

A

a) Default handler

378
Q

Which of these keywords is used to by the calling function to guard against the exception that is thrown by called function?

a) try
b) throw
c) throws
d) catch

A

c) throws

379
Q

a sequence of data

- two kinds of Streams = InPutStream, OutPutStream

A

Stream

380
Q

is used to read data from a source.

A

InPutStream

381
Q

is used for writing data to a destination.

A

OutPutStream

382
Q

perform input and output for 16-bit unicode

  • most frequently used classes are, FileReader and FileWriter.
  • Though internally FileReader uses FileInputStream and FileWriter uses FileOutputStream but here the major difference is that FileReader reads two bytes at a time and FileWriter writes two bytes at a time.
A

Character Streams

383
Q

How to find the number of elements in:

a) an Array
b) an ArrayList
c) a String

A

a) .length
b) .size()
c) .length()

384
Q

stores a reference to the array. Copying the variable yields a second reference to the same array.

A

array variable

385
Q

Syntax of copying an array.

A

double[] prices = (double[]) data.clone();

386
Q

This is used to output the error data produced by the user’s program and usually a computer screen is used for standard error stream and represented as System.err.

A

Standard Streams : Standard Error

387
Q

Two different arrays that should be combined into one array containing objects.

A

parallel arrays