Vous êtes sur la page 1sur 6

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 6
(Answer all questions in this section)

21. Which of the following declares a one dimensional array name scores of

int scores;
int[] scores=new int[14]; (*)
int[] scores=new scores int[14];
int score= new int[14];

Incorrect. Refer to Section 6 Lesson


22. What is the output of the following segment of code?
int array[][] = {{1,2,3},{3,2,1}};
for(int i=0;i<2;i++)
for(int j=0;j<3;j++)
System.out.print(2*array[1][1]);
444444 (*)
123321
246642
222222
This code doesn't compile.

Incorrect. Refer to Section 6 Lesson

23. Which of the following declares and initializes a one dimensional array t

String[] array=new String[5];


Object array=new Object[5]; (*)
Object[] array=new Object[4];
String[] array=String[4];

Incorrect. Refer to Section 6 Lesson


24. Which of the following statements is not a valid array declaration?

int number[];
float []averages;
double marks[5];
counter int[]; (*)
Correct

25. Which of the following is a sorting algorithm that involves repeatedly in

Selection Sort
Merge Sort
Bubble Sort (*)
Sequential Search
Binary Search

Incorrect. Refer to Section 6 Lesson

Previous

Next

Page 5 of 10
Test: Java Fundamentals Final Exam

Summary

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 6
(Answer all questions in this section)

26. Which of the following is the correct lexicographical order for the conen
{17, 1, 1, 83, 50, 28, 29, 3, 71, 22}
{71, 1, 3, 28,29, 50, 22, 83, 1, 17}
{83, 71, 50, 29, 28, 22, 17, 3, 1, 1}
{1, 1, 17, 22, 28, 29, 3, 50, 71, 83}
{1, 2, 7, 0, 9, 5, 6, 4, 8, 3}
{1, 1, 3, 17, 22, 28, 29, 50, 71, 83} (*)
Correct

27. Which searching algorithm involves using a low, middle, and high index

Sequential Search
Merge Sort
Selection Sort
Binary Search (*)
All of the above

Incorrect. Refer to Section 6 Lesson

28. Big-O Notation is used in Computer Science to describe the performanc

True (*)
False

Incorrect. Refer to Section 6 Lesson

29. A logic error occurs if an unintentional semicolon is placed at the end of

True
False (*)
Correct

21.Which of the
following is the
correct
lexicographical
order for the
conents of the int
array?

Mark for Review


(1) Points

{17, 1, 1, 83, 50,


28, 29, 3, 71, 22}
{71, 1, 3, 28,29, 50, 22, 83, 1, 17}
{83, 71, 50, 29, 28, 22, 17, 3, 1, 1}
{1, 1, 17, 22, 28, 29, 3, 50, 71, 83}
{1, 2, 7, 0, 9, 5, 6, 4, 8, 3}
{1, 1, 3, 17, 22, 28, 29, 50, 71, 83} (*)
Correct
22. Selection sort is efficient for large arrays. True or
false?

Mark for
Review
(1) Points

True
False (*)
Incorrect. Refer to Section 6
Lesson 2.
23. Of the options below, what is the fastest run-time?

Mark for
Review
(1) Points

n
n^2
lg(n) (*)
n*lg(n)
Incorrect. Refer to Section 6
Lesson 2.
24. Why might a sequential search be inefficient?

Mark for
Review
(1) Points

It utilizes the "divide and conquer" method, which


makes the algorithm more error prone.
It requires incrementing through the entire array in
the worst case, which is inefficient on large data
sets. (*)
It involves looping through the array multiple
times before finding the value, which is inefficient
on large data sets.
It is never inefficient.
Incorrect. Refer to Section 6
Lesson 2.
25. Which of the following declares a one dimensional
array named names of size 8 so that all entries can be
Strings?

Mark for
Review
(1) Points

String names=new String[8];


String[] name=new Strings[8];
String[] names=new String[8]; (*)
String[] name=String[8];
Incorrect. Refer to Section 6
Lesson 1.
26Which of
. the
following
declares
and

Mark for Review


(1) Points

initializes
a one
dimensio
nal array
named
words of
size 3 so
that all
entries
can be
Strings?
String strings=new String[3];
String[] word={"Over","the","mountain"}; (*)
String[] word=new String[3];
String[] words={"Oracle","Academy"}];
Incorrect. Refer to Section 6 Lesson 1.
27. The following array declaration is valid. True or false?
int k[] = new int[10];
True (*)
False
Incorrect. Refer to Section 6 Lesson 1.
28. What will be the content of the array variable table after executing the following
code?

111
011
001
100
010
001
100
110

001
010
100
Correct
29. It is possible to throw and catch a second exception inside a catch block of code.
True or false?
True (*)
False
Incorrect. Refer to Section 6 Lesson 3.

Vous aimerez peut-être aussi