Devry CIS 355A All Quiz Latest

$50

Quantity:

Description

Devry CIS 355A All Quiz Latest

Devry CIS 355A Week 1 Quiz latest

 

  1. 1.Question : (TCOs 1–8) Every statement in Java ends with _____

a period (.).

a semicolon (;).

a comma (,).

an asterisk (*).

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

public class Test {

public static void main(String[ ] args) {

int month = 09;

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

}

}

The program displays month is 9.0.

The program displays month is 09.

The program displays month is 9.

Question 3. Question : (TCOs 1–8) What is the printout of System.out.println(‘z’ – ‘a’)?

26

z

a

25

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

boolean even = false;

if (even) {

System.out.println(“It is even!”);

}

The code is wrong. You should replace if (even) with if (even == true).

The code displays It is even.

The code displays nothing.

The code is wrong. You should replace if (even) with if (even = true).

Question 5. Question : (TCOs 1–8) The equal comparison operator in Java is _____

^=.

!=.

==.

<>.

Question 6. Question : (TCOs 1–8) After the continue outer statement is executed in the following loop, which statement is executed?

outer:

for (int i = 1; i < 10; i ) {

inner:

for (int j = 1; j < 10; j ) {

if (i * j > 50)

continue outer;

System.out.println(i * j);

}

}

next:

The program terminates.

The statement labeled next.

The control is in the outer loop, and the next iteration of the outer loop is executed.

The control is in the inner loop, and the next iteration of the inner loop is executed.

Question 7. Question : (TCOs 1–8) How many times will the following code print “Welcome to Java”?

int count = 0;

while (count < 10) {

System.out.println(“Welcome to Java”);

}

0

1

10

9

8

Question 8. Question : What is Math.ceil(3.5)?

4.0

5.0

3.0

3

Question 9. Question : What is k

after the following block executes?

{

int k = 2;

nPrint(“A message”, k);

}

System.out.println(k);

1

2

0

The variable k is not defined outside the block, so the program has a compile error.

Question 10. Question : Analyze the following code.

public class Test {

public static void main(String[ ] args) {

int[ ] a = new int[4];

a[1] = 1;

a = new int[2];

System.out.println(“a[1] is ” a[1]);

}

}

The program displays a[1] is 0.

The program displays a[1] is 1.

The program has a compile error because new int[2] is assigned to a.

The program has a runtime error because a[1] is not initialized.

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 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 CIS 355A Week 4 Quiz latest

 

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

public class Test {

public static void main(String[ ] args) {

Number x = new Integer(3);

System.out.println(x.intValue());

System.out.println((Integer)x.compareTo(new Integer(4)));

}

}

The program has a compile error because the member access operator (.) is executed before the casting operator.

The program has a compile error because intValue is an abstract method in Number.

The program compiles and runs fine.

The program has a compile error because x cannot be cast into Integer.

The program has a compile error because an Integer instance cannot be assigned to a Number variable.

Question 2. Question : (TCOs 1–8) Which of the following statements are not correct?

Object i = 4.5;

Integer i = 4.5;

Number i = 4.5;

Double i = 4.5;

Question 3. Question : (TCOs 1–8) Suppose A is an interface and B is a concrete class with a default constructor that implements A.Which of the following is correct?

B b = new B();

A a = new A();

B b = new A();

none of them

Question 4. Question : (TCOs 1–8) Assume Calendar calendar = new GregorianCalendar(). _____ returns the month of the year.

calendar.get(Calendar.MONTH)

calendar.get(Calendar.WEEK_OF_MONTH)

calendar.get(Calendar.MONTH_OF_YEAR)

calendar.get(Calendar.WEEK_OF_YEAR)

Question 5. Question : (TCOs 1–8) Assume Calendar calendar = new GregorianCalendar(). ________ returns the number of days in a month.

calendar.get(Calendar.WEEK_OF_YEAR)

calendar.get(Calendar.WEEK_OF_MONTH)

calendar.get(Calendar.MONTH_OF_YEAR)

calendar.getActualMaximum(Calendar.DAY_OF_MONTH)

calendar.get(Calendar.MONTH)

Question 6. Question : (TCOs 1–8) Pressing a button generates a(n) _____ event.

ContainerEvent

MouseMotionEvent

ItemEvent

ActionEvent

MouseEvent

Question 7. Question : (TCOs 1–8) Every event object has the _____ method.

getSource()

getKeyChar()

getTimeStamp()

getActionCommand()

getWhen()

Question 8. Question : (TCOs 1–8) The interface _____ should be implemented to listen for a button action event.

FocusListener

ContainerListener

ActionListener

MouseListener

WindowListener

Question 9. Question : (TCOs 1–8) To listen to mouse moved events, the listener must implement the _____ interface or extend the _____ class.

ComponentListener/ComponentAdapter.

MouseListener/MouseAdapter.

MouseMotionListener/MouseMotionAdapter.

WindowListener/WindowAdapter.

Question 10. Question : (TCOs 1–8) Which of the following statements registers a panel object p

as a listener for a button variable jbt?

jbt.addActionEventListener(p);

jbt.addActionListener(p);

jbt.addEventListener(p);

addActionListener(p);

Devry CIS 355A Week 5 Quiz latest

 

  1. 1.Question : (TCOs 1–8) Given a graphics object g,

to draw a line from the upper left corner to the bottom right corner, you use _____

g.drawLine(0, 0, getHeight(), getHeight()).

g.drawLine(0, 0, 100, 100).

g.drawLine(0, 0, getWidth(), getHeight()).

g.drawLine(0, 0, getWidth(), getWidth()).

Question 2. Question : (TCOs 1–8) Which of the following statements is false?

You can create a FileInputStream/FileOutputStream from a File object or a file name using FileInputStream/FileOutputStream constructors.

A java.io.FileNotFoundException would occur if you attempt to create a FileOutputStream with a nonexistent file.

All methods in FileInputStream/FileOutputStream are inherited from InputStream/OutputStream.

The return value -1 from the read() method signifies the end of file.

A java.io.FileNotFoundException would occur if you attempt to create a FileInputStream with a nonexistent file.

Question 3. Question : (TCOs 1–8) Given a graphics object g,

to draw a filled oval with width 20 and height 30 centered at (50, 50), you use _____

g.fillOval(30, 30, 40, 30).

g.fillOval(30, 30, 20, 30).

g.fillOval(40, 35, 20, 30).

g.fillOval(50, 50, 20, 30).

g.fillOval(50, 50, 40, 30).

Question 4. Question : (TCOs 1–8) Which of the following statements is correct to create a DataOutputStream to write to a file named out.dat?

DataOutputStream outfile = new DataOutputStream(FileOutputStream(“out.dat”));

DataOutputStream outfile = new DataOutputStream(new File(“out.dat”));

DataOutputStream outfile = new DataOutputStream(new FileOutputStream(“out.dat”));

DataOutputStream outfile = new DataOutputStream(“out.dat”);

Question 5. Question : (TCOs 1-8) With which I/O class can you append or update a file?

DataOutputStream()

RandomAccessFile(),

OutputStream()

None of them

Question 6. Question : (TCOs 1–8) “abc”.compareTo(“aba”) returns _____

2.

1.

-2.

0.

-1.

Question 7. Question : (TCOs 1–8) Which code fragment would correctly identify the number of arguments passed via the command line to a Java application, excluding the name of the class that is being invoked?

int count=0; while (!(args[count].equals(“”))) count ;

int count = args.length;

int count = args.length – 1;

int count = 0; while (args[count] != null) count ;

Question 8. Question : (TCOs 1–8) Assume s is “ABCABC”, the method _____ returns an array of characters.

String.toChars()

s.toChars()

toChars(s)

String.toCharArray()

s.toCharArray()

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

public class Test {

public static void main(String[ ] args) {

String s1 = “Welcome to Java!”;

String s2 = “Welcome to Java!”;

if (s1 == s2)

System.out.println(“s1 and s2 reference to the same String object”);

else

System.out.println(“s1 and s2 reference to different String objects”);

}

}

s1 and s2 reference to the same String object

s1 and s2 reference to different String objects

Question 10. Question : (TCOs 1–8) Which class do you use to write data into a text file?

File

PrintWriter

System

Scanner

Devry CIS 355A Week 6 Quiz latest

 

  1. 1.Question : (TCOs 1–8) Which of the following is true?

You can create a JButton using its default constructor.

You can create a JButton by specifying an icon.

You can create a JButton using its default constructor by specifying a text.

You can create a JButton by specifying a text.

You can create a JButton by specifying an icon and text.

Question 2. Question : (TCOs 1–8) Which of the following statements is false?

You can create a text field with a specified text.

You can disable editing on a text field.

You can specify the number of rows in a text field

You can specify the number of columns in a text field.

You can specify a horizontal text alignment in a text field.

Question 3. Question : (TCOs 1–8) The method _____ gets the contents of the text field jtf.

jtf.findString()

jtf.getText(s)

jtf.getString()

jtf.getText()

Question 4. Question : (TCOs 1–8) Which of the following statements is false?

You can disable editing on a text area.

You can specify the number of columns in a text area.

You can create a text field with a specified text area.

You can specify a horizontal text alignment in a text area.

Question 5. Question : (TCOs 1–8) Clicking a JRadioButton generates _____ events.

ActionEvent

ComponentEvent

JRadioButtonEvent

ContainerEvent

Question 6. Question : (TCOs 1–8) If a prepared statement preparedStatement is a SQL SELECT statement, you execute the statement using _____

preparedStatement.executeQuery();.

preparedStatement.execute();.

preparedStatement.query();.

preparedStatement.executeUpdate();.

Question 7. Question : (TCOs 1–8) Database metadata are retrieved through _____

a PreparedStatement object.

a Statement object.

a ResultSet object.

a Connection object.

Question 8. Question : (TCOs 1–8) Suppose that your program accesses MS Access database. Which of the following statements is false?

If the database is not available, the program will have a runtime error, when attempting to create a connection object.

If the driver for MS Access database is not in the classpath, the program will have a runtime error, indicating that the driver class cannot be loaded.

If the driver for MS Access database is not in the classpath, the program will have a syntax error.

If the database is not available, the program may create it and then connect with it.

Question 9. Question : (TCOs 1–8) Invoking Class.forName method may throw _____

ClassNotFoundException.

IOException.

SQLException.

RuntimeException.

Question 10. Question : (TCOs 1–8) Which of the following statements is false?

PreparedStatement is for SQL query statements only. You cannot create a PreparedStatement for SQL update statements.

The parameters in a prepared statement are denoted using the ? sign.

PreparedStatement is efficient for repeated executions.

PreparedStatement is a subinterface of Statement.

 

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

Devry CIS 355A All Quiz Latest

Best Devry CIS 355A All Quiz Latest

Devry CIS 355A All Quiz Latest