
Array of Structures 2
Authored by Karen Tan
Computers
University
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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;
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
45 questions
X TKJ-INSTALASI SISTEM OPERASI
Quiz
•
1st Grade - University
40 questions
C&SE PRE-KNOWLEDGE SURVEY (A+ 1102-CORE 2)
Quiz
•
University - Professi...
40 questions
Mid Semester Ganjil Kelas XII
Quiz
•
University
40 questions
Soal Pemograman Dasar
Quiz
•
12th Grade - University
35 questions
Pengantar Aplikasi Komputer UTS
Quiz
•
University
39 questions
Eng-103 Vocab 4
Quiz
•
University
40 questions
Latihan Soal Informatika Kelas X
Quiz
•
University
40 questions
Quiz Informatika 7
Quiz
•
9th Grade - University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade