CAI616 Quiz 1

CAI616 Quiz 1

Assessment

Quiz

Other

11th Grade

Medium

Created by

Ayesha Abdullah

Used 2+ times

FREE Resource

Student preview

quiz-placeholder

6 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which type of data is used to enter the value ("Welcome")?
Text
Characters
String
Boolean

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

When we want to print in Java, we use the code ......
system.out.print();
System.out.println();
System.Out.Printf();
System.out.show();

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following code segment.

System.out.print("Hello System.out.println");

System.out.print("!!!");

What is printed as a result of executing the code segment?

Hello!!!

Hello System.out.println!!!

Hello System.out.println

!!!

Hello

!!!

No output

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following code segment.

System.out.print("AP");

System.out.println();

System.out.println("CS");

System.out.print("A");

What is printed as a result of executing the code segment?

APCSA

APCS

A

AP

CSA

AP

CS

A

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following code segment.

System.out.print(I do not fear computers. ); // Line 1

System.out.println(I fear the lack of them.); // Line 2

System.out.println(--Isaac Asimov); // Line 3

The code segment is intended to produce the following output but may not work as intended.

I do not fear computers. I fear the lack of them.

--Isaac Asimov

Which change, if any, can be made so that the code segment produces the intended output?

In line 1, print should be changed to println.In line 1, print should be changed to println.

In lines 2 and 3, println should be changed to print.In lines 2 and 3, println should be changed to print.

The statement System.out.println() should be inserted between lines 2 and 3.

In lines 1, 2, and 3, the text that appears in parentheses should be enclosed in quotation marks.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following code segment.

System.out.print(*); // Line 1

System.out.print("*"); // Line 2

System.out.println(); // Line 3

System.out.println("*"); // Line 4

The code segment is intended to produce the following output, but may not work as intended.

**

*

Which line of code, if any, causes an error?

Line 1

Line 2

Line 3

Line 4