Search Header Logo

Arrays and Linked Lists Quiz

Authored by Seven Castueras

Computers

University

Used 2+ times

Arrays and Linked Lists Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

45 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of the following best defines an array?

A collection of variables of different data types stored randomly in memory

A sequential collection of elements of the same type stored in contiguous memory locations

A dynamic list of heterogeneous elements stored on the heap

A collection of key-value pairs stored in non-sequential order

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What happens when you declare an array as int arr[5] = {1, 2}; in C?

Compiler error because not all 5 values are initialized

The array contains {1, 2, 0, 0, 0}

The array contains {1, 2, garbage, garbage, garbage}

Array size automatically becomes 2

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

In Java, which of the following is NOT a valid array declaration?

int[] numbers;

int numbers[];

int numbers = new int[10];

int[] numbers = new int[5];

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

(Scenario) A developer wants to create an array that stores ["apple", 10, true]. Which language allows this directly without error?

C

C++

Java

JavaScript

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

True/False (as MCQ): Python has a built-in array data type that strictly enforces homogeneity of elements.

True

False

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of the following is an example of a two-dimensional array declaration in C?

int arr[3][4];

int arr[12];

int arr(3,4);

int arr[3,4];

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

(Scenario) Suppose an array has 100 elements. A student writes a loop to print all elements. What is the time complexity of this traversal?

O(1)

O(log n)

O(n)

O(n²)

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?