PP2-Test1 Review

¡Supera tus tareas y exámenes ahora con Quizwiz!

Match the term to its definition. __4__ Ability to take the form of itself, parent, grandparent, etc __3__acquiring all the properties and behaviors of a parent object __1__showing only essential information __2__wrapping up of data and operations on the data under a single unit

1.Abstraction 2.Encapsulation 3.Inheritance 4.Polymorphism

Match the definitions to the terms. __1__ can be multi dimensional __1__ holds the constant number of values of the same type __2__ automatically grows and shrinks as needed __2__ cannot store primitive type __2__ can only be single dimensional __1__ has a contiguous memory location

1.Array 2.ArrayList

Match the statement to the term __1__ returns a formatted string with the value in var formatted to an integer. __2__ returns a formatted string with the value in var formatted to 2 decimal places.

1.String.format("%d", var); 2.String.format("%2.2f", var);

Match the term to its definition. ____ models has-a relationships and represents an ownership relationship between two objects where the child can exist independently of the parent ____ models has-a relationships and represents an ownership relationship between two objects where the child cannot exist independent of the parent ____ is a general binary relationship that describes an activity between two classes

2. Aggregation 3.Composition 1. Association

An object is an instance of a ________. Question options: A)class B)program C)method D)data

A)class

What is the value of times displayed? public class Test { public static void main(String[] args) { Count myCount = new Count(); int times = 0; for (int i=0; i<100; i++) increment(myCount, times); System.out.println("myCount.count = " + myCount.count);System.out.println("times = "+ times); } public static void increment(Count c, int times) {c.count++;times++; } } class Count {int count; Count(int c) {count = c; } Count() {count = 1; } } A)0 B)100 C)101 D)98 E)99

A.0

Analyze the following code: class Test { private double i; public Test(double i) { this.t();this.i = i; } public Test() { System.out.println("Default constructor"); this(1); } public void t() { System.out.println("Invoking t"); } } A)this(1) must be replaced by this(1.0). B)this(1) must be called before System.out.println("Default constructor"). C)this.i must be replaced by i. D)The code will compile and run without any errors

B)this(1) must be called before System.out.println("Default constructor").

Which one of the following best describes a feature provided by Junit? A.Provides support for documenting source code B.Code compilation C.Provides support to test drivers for running tests D.Provides support for refactoring code

C.

________ is invoked to create an object. Question options: A)A method with the void return type B)The main method C)A method with a return type D)A constructor

D)A constructor

________ represents an entity in the real world that can be distinctly identified. Question options: A)A method B)A data field C)A class D)An object

D)An object

Analyze the following code: public class Test { public static void main(String[] args) { A a = new A(); a.print(); } } class A {String s; A(String s) { this.s = s; } void print() { System.out.println(s); } } A)The program has a compilation error because class A is not a public class. B)The program compiles and runs fine and prints nothing. C)The program has a compilation error because the print method is not a public method. D)The program has a compilation error because class A does not have a default constructor.

D)The program has a compilation error because class A does not have a default constructor.

Regression testing is a full or partial selection of already executed test cases which are re-executed to ensure existing functionalities work fine

True

You use the plus sign (+) to denote public data or methods.

True

You use underline to denote static variables and methods.

True

What's the git command that downloads your repository from GitHub to your computer? a)clone b)commit c)fork d)push

a.clone

What's the git command that uploads your code from your computer to GitHub? a)push b)clone c)commit d)stage

a.push

The default value for data field of a boolean type, numeric type, object type is ________, respectively. Question options: A)true, 1, Null B)false, 0, null C)true, 0, null D)true, 1, null E)false, 1, null

b. false,0,null

Given the declaration Circle x = new Circle(), which of the following statement is most accurate? Question options: A)You can assign an int value to x. B)x contains an object of the Circle type. C)x contains an int value. D)x contains a reference to a Circle object.

d. x contains a reference to a Circle object.

What is the String returned after executing the following statement "Welcome".subString(2); Question options: a)"come" b)"Welcome" c)"Wel" d)"lcome"

d.lcome


Conjuntos de estudio relacionados

Developmental Psych Chapter 2: Biological Beginnings

View Set

Chapter 3: Evaluating a Company's External Environment

View Set

Guía de Estudio para el examen de conocimientos

View Set

BSAD 181 Midterm Exam (Chapter 14)

View Set

Chapter 6: Attitudes and Persuasion

View Set

Geology Exam 2 DSM & Quiz Questions

View Set

Chapter 2: Traditional and Contemporary Management Perspectives

View Set

Types of Informative Presentations

View Set