
Array of Structures 2

Quiz
•
Computers
•
University
•
Medium
Karen Tan
Used 1+ times
FREE Resource
40 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
Which of the following declares an array of structures of size 5, where each structure holds two integers (x and y)?
struct point arr[5];
struct point arr[] = {x: 1, y: 2};
struct point {int x; int y;} arr[5];
struct point arr = {1, 2};
2.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
What is the correct way to access the second element’s x field of an array of structures called points?
points[1].x;
points[0].x;
points.x[1];
points.x[2];
3.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
Given a pointer p to an array of structures, which statement accesses the third element's y field?
p[2].y;
(*p[2]).y;
(*p).y[2];
p->y[2];
4.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
Which of the following code snippets correctly traverses an array of structures points of size 5 and prints all the x values?
for (int i = 0; i arr[0] = 10;
for (int i = 0; i < 5; i++) printf("%d", points[i].x);
for (int i = 0; i < 5; i++) printf("%d", arr[i].x);
struct data {int arr[5];} *d; d.arr[0] = 10;
5.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
What is the correct way to access the y value of the second point using a pointer to the array?
points[1].y;
points->y;
points[2].y;
points[1]->y;
6.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
What is the correct way to calculate the size of an array of structures arr containing 10 elements of type struct point?
sizeof(arr);
sizeof(arr) / sizeof(struct point);
sizeof(struct point) / sizeof(arr);
sizeof(arr) / sizeof(struct point*);
7.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
Which of the following accesses the field y in the nested structure inner_var?
outer.inner_var.y;
outer.inner_var->y;
outer->inner_var.y;
outer.inner_var[1].y;
Create a free account and access millions of resources
Similar Resources on Wayground
41 questions
Q2 PKS II TPB 10

Quiz
•
University
40 questions
Quiz Tipe Data dan Fungsi

Quiz
•
University
45 questions
Event Driven Handouts 1 & 2

Quiz
•
University
35 questions
SOAL PSAS Informatika XI.5

Quiz
•
11th Grade - University
44 questions
LATIHAN PYTHON

Quiz
•
10th Grade - University
40 questions
Python Final

Quiz
•
University
40 questions
Power Point - Photoshop

Quiz
•
6th Grade - University
40 questions
PRF192 (41 - 80)

Quiz
•
University
Popular Resources on Wayground
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World

Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
20 questions
ELA Advisory Review

Quiz
•
7th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns

Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
11 questions
NFL Football logos

Quiz
•
KG - Professional Dev...
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
38 questions
Unit 6 Key Terms

Quiz
•
11th Grade - University
20 questions
La Hora

Quiz
•
9th Grade - University
7 questions
Cell Transport

Interactive video
•
11th Grade - University
7 questions
What Is Narrative Writing?

Interactive video
•
4th Grade - University