Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

EXTREMELY URGENT What is the order of complexity of this expression? 42 + lg N Question 1 options: O (2 N ) O (lg N)

EXTREMELY URGENT

What is the order of complexity of this expression?

42 + lg N

Question 1 options:

O (2N)

O (lg N)

O (N2)

O (N lg N)

O (1)

O (N)

None of the above

Question 2 (2 points)

What is the order of complexity of this expression?

14*N + 36 * N lg N + 90

Question 2 options:

O (2N)

O (lg N)

O (N2)

O (N lg N)

O (1)

O (N)

None of the above

Question 3 (2 points)

What is the order of complexity of this expression?

2N + 82 + N2

Question 3 options:

O (2N)

O (lg N)

O (N2)

O (N lg N)

O (1)

O (N)

None of the above

Question 4 (2 points)

What is the order of complexity of this segment of code?

for (int i=0; i < (N * N); i++)

System.out.println(i);

Question 4 options:

O (2N)

O (lg N)

O (N2)

O (N lg N)

O (1)

O (N)

None of the above

Question 5 (2 points)

What is the order of complexity of this segment of code?

for (int i = 0; i < N; i++)

for (int j=0; i < 15; i++)

System.out.println (i*j);

Question 5 options:

O (2N)

O (lg N)

O (N2)

O (N lg N)

O (1)

O (N)

None of the above

Question 6 (2 points)

What is the order of complexity of this segment of code?

for (int j = 1; j < N; j++)

for (int k= 1; k < N; k=k*2)

System.out.println (j + k);

Question 6 options:

O (2N)

O (lg N)

O (N2)

O (N lg N)

O (1)

O (N)

None of the above

Widening and Narrowing

Use this code to answer the following questions:

Object obj;

String str;

Song sng = new Song("Rockstar", 5);

obj = sng; // #7

sng = str; // #8

str = (String) obj; // #9

sng = obj; // #10

Question 7 (2 points)

Is line #7 above an example of widening or narrowing?

Question 7 options:

Widening

Narrowing

Question 8 (2 points)

Does line #8 above cause a runtime error, a compilation error or no error?

Question 8 options:

Runtime error

Compilation error

No error

Question 9 (2 points)

Does line #9 above cause a runtime error, a compilation error or no error?

Question 9 options:

Runtime error

Compilation error

No error

Question 10 (2 points)

Line #10 above requires a typecast.

Question 10 options:

True
False

Array-based Lists vs Linked Lists

Question 11 (2 points)

Array-based lists are preferred over linked lists when the number of elements in the list is not known ahead of time.

Question 11 options:

True
False

Question 12 (2 points)

Array-based lists are preferred over linked lists when the number of elements in the list varies from very small to very large.

Question 12 options:

True
False

Question 13 (2 points)

Array-based lists are preferred over linked lists when it is necessary to directly access list elements by their position in the list.

Question 13 options:

True
False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions