Devry CIS 355A Week 3 Quiz latest

$14

Quantity:

Description

Devry CIS 355A Week 3 Quiz latest

  1. 1.Question : (TCOs 1–8) What is the output of running class C?

class A {

public A() {

System.out.println(

“The default constructor of A is invoked”);

}

}

class B extends A {

public B() {

System.out.println(

“The default constructor of B is invoked”);

}

}

public class C {

public static void main(String[ ] args) {

B b = new B();

}

}

Nothing displayed

“The default constructor of A is invoked”

“The default constructor of B is invoked” “The default constructor of A is invoked”

“The default constructor of A is invoked” “The default constructor of B is invoked”

“The default constructor of B is invoked”

Question 2. Question : (TCOs 1–8) The getValue() method is overridden in two ways. Which one is correct?

// Program I:

public class Test {

public static void main(String[ ] args) {

A a = new A();

System.out.println(a.getValue());

}

}

class B {

public String getValue() {

return “Any object”;

}

}

class A extends B {

public Object getValue() {

return “A string”;

}

}

// Program II:

public class Test {

public static void main(String[ ] args) {

A a = new A();

System.out.println(a.getValue());

}

}

class B {

public Object getValue() {

return “Any object”;

}

}

class A extends B {

public String getValue() {

return “A string”;

}

}

I

II

Both I and II

Neither

Question 3. Question : (TCOs 1–8) Invoking _____ returns the number of the elements in an ArrayList x.

x.getLength(0)

x.size()

x.length(1)

x.getSize()

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

class C1 {}

class C2 extends C1 { }

class C3 extends C2 { }

class C4 extends C1 {}

C1 c1 = new C1();

C2 c2 = new C2();

C3 c3 = new C3();

C4 c4 = new C4();

which of the following expressions evaluates to false?

c3 instanceof C1

c4 instanceof C2

c1 instanceof C1

c2 instanceof C1

Question 5. Question : (TCOs 1–8) Suppose you create a class Cylinder to be a subclass of Circle. Analyze the following code.

class Cylinder extends Circle {

double length;

Cylinder(double radius) {

Circle(radius);

}

}

The program compiles fine, but it has a runtime error because of invoking the Circle class’s constructor illegally.

The program compiles fine, but you cannot create an instance of Cylinder because the constructor does not specify the length of the cylinder.

The program has a compile error because you attempted to invoke the Circle class’s constructor illegally.

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

import java.awt.*;

import javax.swing.*;

public class Test {

public static void main(String[ ] args) {

JFrame frame = new JFrame(“My Frame”);

frame.add(new JButton(“OK”));

frame.add(new JButton(“Cancel”));

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setSize(200, 200);

frame.setVisible(true);

}

}

Both button OK and button Cancel are displayed, and button OK is displayed on the left side of button OK.

Both button OK and button Cancel are displayed, and button OK is displayed on the right side of button OK.

Only button OK is displayed.

Only button Cancel is displayed.

Question 7. Question : (TCOs 1–8) What should you use to position a Button within an application Frame so that the size of the Button is not affected by the Frame size?

A FlowLayout

The East or West area of a BorderLayout

The North or South area of a BorderLayout

A GridLayout

The center area of a BorderLayout

Question 8. Question : (TCOs 1–8) What layout manager should you use so that every component occupies the same size in the container?

Any layout

A FlowLayout

A BorderLayout

A GridLayout

Question 9. Question : (TCOs 1–8) The correct order of the following three statements is _____

frame.setLocationRelativeTo(null); // 1

frame.setSize(100, 200); // 2

frame.setVisible(true); // 3

2 1 3.

1 3 2 .

3 2 1 .

1 2 3.

Question 10. Question : (TCOs 1–8) To specify a font to be bold and italic, use the font style value _____

Font.BOLD.

Font.BOLD Font.ITALIC.

Font.PLAIN.

Font.ITALIC.

 

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

Devry CIS 355A Week 3 Quiz latest

Best Devry CIS 355A Week 3 Quiz latest

Devry CIS 355A Week 3 Quiz latest