Search Header Logo
Untitled Presentation

Untitled Presentation

Assessment

Presentation

Computers

2nd Grade

Hard

Created by

Haider Abbas

Used 1+ times

FREE Resource

12 Slides • 12 Questions

1

media

2

media

3

Open Ended

Describe a scenario where using an array in C++ would be more beneficial than declaring multiple individual variables.

4

Multiple Choice

What is the significance of using arrays in C++ for managing data?

1

They allow storing multiple values of the same type efficiently.

2

They help in storing different types of data together.

3

They automatically sort data.

4

They eliminate the need for memory allocation.

5

media

6

Multiple Choice

Which of the following correctly declares an array of 10 integers in C++?

1

int marks[10];

2

float marks[10];

3

char marks[10];

4

int marks(10);

7

media

8

media

9

media

10

Multiple Choice

Which of the following statements about static and dynamic array initialization is correct?

1

Static initialization assigns values at declaration, dynamic assigns values later.

2

Dynamic initialization assigns values at declaration, static assigns values later.

3

Both static and dynamic assign values at declaration.

4

Neither static nor dynamic assign values at declaration.

11

media

12

Multiple Select

Select all correct statements about traversing arrays.

1

Traversing means visiting each element of an array.

2

A for loop can be used to traverse an array.

3

A while loop cannot be used to traverse an array.

4

Traversing is only possible for integer arrays.

13

media

14

Open Ended

How can you find the number of elements in an array using the sizeof() function in C++?

15

Fill in the Blanks

Type answer...

16

media

17

Multiple Choice

Which of the following statements correctly describes how the highest and lowest marks are found in the given program example?

1

By comparing each mark to the current max and min values inside a loop.

2

By sorting the array and picking the first and last elements.

3

By using a built-in function to find max and min.

4

By calculating the average and comparing each mark to it.

18

media

19

media

20

Multiple Select

Which of the following are valid ways to initialize a two-dimensional array in C++?

1

int arr[2][3] = { {1,2,3}, {4,5,6} };

2

int arr[2][3]; for(int i=0;i<2;i++) for(int j=0;j<3;j++) arr[i][j]=i+j;

3

int arr[2][3] = {1,2,3,4,5,6};

4

int arr[2][3] = {{1,2},{3,4},{5,6}};

21

media

22

Fill in the Blanks

Type answer...

23

Open Ended

How would you explain the concept of arrays in C++ to someone new to programming?

24

Multiple Choice

What is the main advantage of using arrays in C++?

1

They allow you to manage multiple values of the same type efficiently.

2

They allow you to use different data types in a single array.

3

They automatically sort data.

4

They eliminate the need for memory allocation.

media

Show answer

Auto Play

Slide 1 / 24

SLIDE