CNMT110 Test 2

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is shadowing?

A backup copy of each file being worked on is written every few minutes to the hard drive, or to another location

Can a constant be passed as an argument to a method?

A constant argument is the one whose modification cannot take place by the function.

What is an accessor method?

A method that returns a value from a class's attribute but does not change it

Does declaring an array reference variable create an array?

Declaring a variable of array type does not create an array object or allocate any space for array components

Does Java limit the number of dimensions an array may have?

Java does not limit the number of dimensions that an array may have.

What is the motivation of using methods in a program?

Overloaded methods are often used to perform similar operations on different types of data. To motivate generic methods, let's begin with an example containing overloaded printArray methods that print the String representations of the elements of an Integer array, a Double array and a Character array, respectively.

What is an initialization list of an array?

a comma-separated list of constant expressions enclosed in braces ( { } )

What is a no argument constructor?

a constructor that does not accept any arguments

What is a default constructor?

a constructor that either has no parameters, or if it has parameters, all the parameters have default values

What is a mutator method?

a method used to control changes to a variable

What is a ragged array?

a special type of Multidimensional array where there are a variable number of columns in each row.

What is a public access specifier?

allows a class to expose its member variables and member functions to other functions and objects

What is a private access specifier?

allows a class to hide its member variables and member functions from other functions and objects

What is the value of the public field named length of an array?

an unsigned, 32-bit integer that is always numerically greater than the highest index in the array.

Does the index of an array start with zero or one?

array index starts from 0

How to compare the content of two arrays?

checking whether both the arrays contain the same number of elements or not, and whether all those elements have the same value or not. Methods to compare two arrays in Javascript are: Equality comparison: Using the == or === operators.

How is data hiding accomplished in Java?

declaring the class fields as private and providing public getter and setter methods to access and modify the field values.

What is the meaning of "return" in a method body?

ends the execution of a function, and returns control to the calling function

What is a package?

organizes Java classes into namespaces, providing a unique namespace for each type it contains.

What is an access specifier of a method?

Access specifiers define how the members (attributes and methods) of a class can be accessed

Can an ArrayList object automatically expand its size?

An ArrayList object automatically expands in size to accommodate the items stored in it

What does "static" in a method header mean?

The term static means that the method is available at the Class level, and so does not require that an object is instantiated before it's called.

What is the difference between an argument and a parameter for a method?

The values that are declared within a function when the function is called are known as an argument. Whereas, the variables that are defined when the function is declared are known as a parameter.

Can an array hold different types of values?

They can store numbers, strings, boolean values (true and false), characters, objects, and so on.

What is an instance field?

the data of a class that enables an object to maintain its state

What is the scope of a method parameter?

the method body in which the parameter is located


Ensembles d'études connexes

PNE 105 Ch 51: Caring for Clients with Diabetes Mellitus. Med-Surg.

View Set

Chapter 4: Health Education & Health Promotion

View Set

Business Data Warehousing - Exam II

View Set

Washington Real Estate Law (Continuing Education 2021)

View Set

Rock the SAT: Silence, Reticence

View Set

Exam: 01.02 Introduction to Functions

View Set