Search Header Logo

Quiz 2

Authored by Ms. Asst.Prof

Computers

University

Used 1+ times

Quiz 2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the length of the following array byte[] data= {12, 34, 9, 0, 62, 88 };

1

5

6

12

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code fragment:

int[] arr= {2, 4, 6, 8, 10, 1, 3, 5, 7, 9};

for(int index=0; index<5; index++)

System.out.print(arr[index]+ " ");

2 4 6 8

2 4 6 8 10

2 4 6 8 10 1

2 4 6 8 10 1 3 5 7 9

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int[] arr = { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9};

for(int index=0; index<arr.length; index++)

System.out.println(arr[index]+" ");

2 4 6 8

2 4 6 8 10

2 4 6 8 10 1

2 4 6 8 10 1 3 5 7 9

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these method of class String is used to extract a single character from a String object?

CHARTAT()

charat()

chatAt()

CharAt()

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these operators can be used to concatenate two or more String objects?

+

+=

&

||

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which is the output of the following code fragement

int[] egArray = { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 };

for(int index=0; index<egArray.length; index=index+2)

System.out.print(egArray[index]+ " ");

2 4 6 8 10 1 3 5 7 9

4 8 1 5 9

2 6 10 3 7

2 6 10 3 7 0

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Does a programmer always know long an array will be when the program is being written?

Yes--the program will not compile without the length being declared.

No-- the array object is created when the program is running, and the length might change from run to run.

Yes-- otherwise the program will not run correctly.

No--arrays can grow to whatever length is needed.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?