
Array of structures
Quiz
•
Computers
•
University
•
Medium
Karen Tan
Used 1+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
2 mins • 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
2 mins • 20 pts
What is the correct way to access the second element’s x field of an array of structures called points?
points.x[1];
points[0].x;
points[1].x;
points.x[2];
3.
MULTIPLE CHOICE QUESTION
2 mins • 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
2 mins • 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;
struct data {int arr[5];} *d; d.arr[0] = 10;
5.
MULTIPLE CHOICE QUESTION
2 mins • 20 pts
Given the following code: struct point { int x; int y; }; struct point points[3] = {{1,2}, {3,4}, {5,6}}; 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
2 mins • 20 pts
What is the correct way to define a structure named 'circle' that contains a float for the radius and a point structure for the center?
struct circle {struct point center; float radius;};
struct circle {float radius; struct point center;};
struct circle {float radius; int center[2];};
struct circle {int center[2]; float radius;};
7.
MULTIPLE CHOICE QUESTION
2 mins • 20 pts
Given an array of structures 'shapes' of size 4, how can you access the y value of the first shape?
shapes[0].y;
shapes[1].y;
shapes.y[0];
shapes[0]->y;
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
20 questions
Quiz Harian Gdevelop MPK
Quiz
•
University
15 questions
Computer and Other Human Inventions
Quiz
•
University
20 questions
Input/Output
Quiz
•
University
15 questions
Robotics Prelim
Quiz
•
University
20 questions
Digital and Analog transmission
Quiz
•
University
15 questions
GIS Unit III
Quiz
•
University
15 questions
ADB Quiz #1
Quiz
•
University
20 questions
2.3.1 Graph Traversal & Path Finding Algorithms
Quiz
•
12th Grade - University
Popular Resources on Wayground
20 questions
Halloween Trivia
Quiz
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Order of Operations
Quiz
•
5th Grade
20 questions
Halloween
Quiz
•
5th Grade
16 questions
Halloween
Quiz
•
3rd Grade
12 questions
It's The Great Pumpkin Charlie Brown
Quiz
•
1st - 5th Grade
20 questions
Possessive Nouns
Quiz
•
5th Grade
10 questions
Halloween Traditions and Origins
Interactive video
•
5th - 10th Grade
Discover more resources for Computers
10 questions
Halloween Movies Trivia
Quiz
•
5th Grade - University
12 questions
Halloween
Quiz
•
3rd Grade - University
5 questions
Using Context Clues
Interactive video
•
4th Grade - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
14 questions
Eat Healthy,Be Healty
Quiz
•
4th Grade - University
7 questions
History of Halloween: Pagan or Christian?
Interactive video
•
11th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
