Array and Pointer Quiz

Array and Pointer Quiz

University

41 Qs

quiz-placeholder

Similar activities

8 CĐ 2 full

8 CĐ 2 full

7th Grade - University

37 Qs

kelas 2 ats

kelas 2 ats

8th Grade - University

45 Qs

Ujian Akhir Semester Informatika

Ujian Akhir Semester Informatika

7th Grade - University

40 Qs

SUMATIF AKHIR SEMESTER INFORMATIKA KELAS 9

SUMATIF AKHIR SEMESTER INFORMATIKA KELAS 9

8th Grade - University

45 Qs

Kelas 7 Komputasional

Kelas 7 Komputasional

7th Grade - University

40 Qs

Ulangan Harian.1.1

Ulangan Harian.1.1

10th Grade - University

36 Qs

Tema 3. Recepción y distribución de radio y TV terrestre

Tema 3. Recepción y distribución de radio y TV terrestre

2nd Grade - University

40 Qs

Infinity Code Nexus

Infinity Code Nexus

University

40 Qs

Array and Pointer Quiz

Array and Pointer Quiz

Assessment

Quiz

Information Technology (IT)

University

Practice Problem

Medium

Created by

PRIYADHARSHNI S

Used 3+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

41 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

You are writing a program to store some scores in an array. You want to print the third score stored. int arr[] = {1, 2, 3, 4}; printf("%d", arr[2]); What is the output?

1

2

3

4

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

You have two arrays representing sensor readings. You want to calculate the sum of the first and last values in one of these arrays. int arr[] = {5, 6, 7}; printf("%d", arr[0] + arr[2]); What is the output?

5

6

7

12

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

You partially initialize an array and want to print the first and last elements of it. int arr[4] = {1}; printf("%d %d", arr[0], arr[3]); What is the output?

1 1

1 0

0 1

0 0

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In a loop, you print all elements of an integer array initialized with three values. int arr[3] = {10, 20, 30}; for(int i = 0; i < 3; i++) printf("%d ", arr[i]); What does this print?

10 20 30

20 30 10

30 20 10

10 30 20

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

You store characters in a char array intending it to be a string and then print it. char arr[] = {'a', 'b', 'c', '\0'}; printf("%s", arr); What does this output?

abc

a

ab

Error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

You use pointer arithmetic to access the second element of an integer array. int arr[3] = {1, 2, 3}; printf("%d", *(arr + 1)); What is the output?

1

2

3

Garbage value

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

You are confused about pointer dereferencing and arithmetic. You print *arr + 1 on an integer array. int arr[3] = {1, 2, 3}; printf("%d", *arr + 1); What is the output?

0

1

2

3

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?