Devry CIS 355A Week 2 Quiz latest

$14

Quantity:

Description

Devry CIS 355A Week 2 Quiz latest

  1. 1.Question : (TCOs 1–8) What is the output of the following program?

import java.util.Date;

public class Test {

public static void main(String[ ] args) {

Date date = new Date(1234567);

m1(date);

System.out.print(date.getTime() ” “);

m2(date);

System.out.println(date.getTime());

}

public static void m1(Date date) {

date = new Date(7654321);

}

public static void m2(Date date) {

date.setTime(7654321);

}

}

1234567 1234567

1234567 7654321

7654321 7654321

7654321 1234567

Question 2. Question : (TCOs 1–8) Analyze the following code.

public class Test {

private int t;

public static void main(String[ ] args) {

int x;

System.out.println(t);

}

}

t is non-static, and it cannot be referenced in a static context in the main method.

The variable x is not initialized, and therefore, causes errors.

The program compiles and runs fine.

The variable t is not initialized, and therefore, causes errors.

The variable t is private, and therefore, cannot be accessed in the main method.

Question 3. Question : (TCOs 1–8) _____ is invoked to create an object.

A method with a return type

A method with the void return type

A constructor

The main method

Question 4. Question : (TCOs 1–8) Analyze the following code.

public class Test {

public static void main(String[ ] args) {

int n = 2;

xMethod(n);

System.out.println(“n is ” n);

}

void xMethod(int n) {

n ;

}

}

The code prints n is 1.

The code prints n is 3.

The code has a compile error because xMethod is not declared static.

The code has a compile error because xMethod does not return a value.

The code prints n is 2.

Question 5. Question : (TCOs 1–8) When invoking a method with an object argument, _____ is passed.

the reference of the object

the object is copied, then the reference of the copied object

the contents of the object

a copy of the object

Question 6. Question : (TCOs 1–8) What is the printout for the third statement in the main method?

public class Foo {

static int i = 0;

static int j = 0;

public static void main(String[ ] args) {

int i = 2;

int k = 3;

{

int j = 3;

System.out.println(“i j is ” i j);

}

k = i j;

System.out.println(“k is ” k);

System.out.println(“j is ” j);

}

}

j is 2

j is 3

j is 1

j is 0

Question 7. Question : (TCOs 1–8) Set methods are also commonly called _____ methods, and get methods are also commonly called _____ methods.

query, mutator

accessor, mutator

mutator, accessor

query, accessor

Question 8. Question : (TCOs 1–8) Which statement is false?

An enum declaration is a comma-separated list of enum constants and may optionally include other components of traditional classes, such as constructors, fields, and methods.

Any attempt to create an object of an enum type with operator new results in a compilation error.

An enum constructor cannot be overloaded.

Enum constants are implicitly final and static.

Question 9. Question : (TCOs 1–8) A final field should also be declared _____ if it is initialized in its declaration.

private

public

protected

static

Question 10. Question : (TCOs 1–8) Which statement is false?

The compiler always creates a default constructor for a class.

If a class’s constructors all require arguments and a program attempts to call a no-argument constructor to initialize an object of the class, a compilation error occurs.

A constructor can be called with no arguments only if the class does not have any constructors or if the class has a public no-argument constructor.

 

DeVry Courses helps in providing the best essay writing service. If you need 100% original papers for Devry CIS 355A Week 2 Quiz latest, then contact us through call or live chat.

Devry CIS 355A Week 2 Quiz latest

Best Devry CIS 355A Week 2 Quiz latest

Devry CIS 355A Week 2 Quiz latest