Java

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What is the time complexity(in "big O notation") of merge sort?

O(N log(N))

What is the time complexity (in "big O notation") of selection sort

O(N^2)

What is the time complexity(in"Big-O notation") of this algorithm

O(n^2)

________________ is a GUI widget toolkit for Java

Swing

In Java, arrays are objects. They are not allocated on the stack, and they do not involve the use of pointer arithmetic, so they avoid the dangers of overflows and out-of-bounds memory accesses that are inherent with C++ arrays

True

In designing classes, it is a good idea to always keep data private. If an instance field needs to be accessed and/or changed from outside the class, this should be done using accessor and mutator methods(also known as getter methods and setter methods)

True

In designing classes, it is a good idea to avoid using too many instance fields in a single class. This is particularly true of multiple, related instance fields of one or more of the basic data types. If you find that you are creating many such fields, the data in those fields might be best be represented by creating a new type(such as the Point data type seen in the previous question)

True

Interfaces are only allowed to have abstract methods and static final attributes

True

Java performs automatic garbage collection; objects that are "unreachable" are periodically collected and removed, and the memory they consumed is reclaimed and made available for new objects

True

Java programs are complied to bytecode, not native machine code

True

One example of the answer to the previous question is Model-View-Controller, which is useful for implementing user interfaces, particularly in GUI-enabled applications

True

When a parameter is passed to a method in Java, pass-by-value is always used. If the parameter being passed is an object reference, the method receives a copy of the original reference

True

You can not store primitive values(int, double, etc.) in an ArrayList

True

___________ delegated the creation of GUI elements(such as text boxes and buttons) to the native operating system platform, while_________ paints these elements onto blank windows, ensuring that they always look and behave the same, regardless of platform

The Abstract Window Toolkit(AWT), Swing

Which of these statements accurately describe the object-oriented features of the Java language?

"Object" is the root class of all objects A subclass can inherit from a superclass Objects can share behaviors with other objects

___________ are a way of structuring your code in order to elegantly express a functional relationship between components. They typically describe a context(a situation which gives rise to a design problem), then they are describe the problem (usually as a set of conflicting forces), and they finally describe a solution as a configuration that balances theses forces

Design patterns

If you do not specify a public or private access modifier when declaring a member( a method or an instance field) of a class, then the member is made private by default

False

In designing classes, it is a good idea to have one class perform a significant percentage of the work in a program, to minimize the number of classes that must be defined

False

Java considers the variable names number and NuMbEr to be identical

False

To create a GUI in Java, we often begin by creating a _______ object, and using this as a container for one or more ________ objects, which we then populate with GUI elements

JFrame;JPanel

The__________________ method produces random numbers

Math_random()

A class can extend only one other class, but can implement many interfaces

True

A class can use all classes from its own package. To use public classes from other packages, you can add the full package name in front of every class name, or you can use an import statement

True

A class must implement all abstract methods inherited from a parent class or from an interface, or else it must be declared abstract itself

True

In Java, all variables must be given a type when they are declared

True

A class contains____________ that are invoked to create objects from the class blueprint

constructors

Repeating a set of instructions a specific number of times is called_____________ repetition

definite(or counter-controlled

In Java, the__________ modifier is used to declare constant variables

final

In java, the_______ modifier is used to declare constant variables

final

The_________ statement is used to execute one action when a condition is true and another action when that condition is false

if........ else

The number used to refer to a particular element of an array is called the element's_____________

index

Inheritance establishes a(n)___________ relationship between the child and the parent class

is-a

A variable known only within the method in which it is declared is called a(n)

local variable

A variable known only within the scope in which it is declared is called a

local variable

A method is invoked with a

method call

A method is invoked with a(n)________

method call

Members of a class specified as_______ are visible only to methods of the class

private

Members of a class specified as__________ are accessible only to methods of the class

private

A member of a class specified as_______ is visible within its own package, and in addition, to a subclass of its class in another package

protected

Members of a class specified as______ are visible to all classes everywhere

public

When it is not known in advance how many times a set of statements will be repeated, a____________ value can be used to terminate the repetition

sentinel(or flag)

The_________ keyword is used to create fields and methods that belong to a class, rather than to an instance of the class. This means that those fields and methods can be accessed without first creating an object.

static

The keyword_________ indicates that a method does not return a value

void

The keyword__________ indicates that a method does not return a value

void


संबंधित स्टडी सेट्स

Ch. 8 Quiz: Project Quality Management

View Set

Business Law Chapter 13 Statue of Frauds

View Set

DE World Civ Industrial Revolution Ch. 23 Test

View Set