
Structure and Array Quiz
Quiz
•
Computers
•
University
•
Practice Problem
•
Easy
Karen Tan
Used 2+ times
FREE Resource
Enhance your content in a minute
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
What will be the output of the following program? #include struct emp_rec { char emp_name[30]; char emp_ID[10]; }; int main() { struct emp_rec emp = {"Alice", "E12345"}; printf("%s %s\n", emp.emp_name, emp.emp_ID); return 0; }
Compilation error
Alice E12345
Garbage value
E12345 Alice
2.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
What will be the output of the following program? #include <stdio.h>
struct emp_rec {
char emp_name[30];
float salary;
};
int main() {
struct emp_rec emp[3] = {{"Jack", 50000}, {"Mia", 60000}, {"Noah", 55000}};
int max_index = 0;
for (int i = 1; i < 3; i++)
if (emp[i].salary > emp[max_index].salary)
max_index = i;
printf("%s\n", emp[max_index].emp_name);
return 0;
}
Jack
Noah
Mia
Error not found
3.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
What is the output of the following code? #include struct emp_rec { char emp_name[30]; int emp_ID; }; int main() { struct emp_rec emp[2] = {{"Bob", 1001}, {"Charlie", 1002}}; printf("%s %d\n", emp[1].emp_name, emp[1].emp_ID); return 0; }
Bob 1001
Charlie 1002
Compilation error
1002 Charlie
4.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
What will be the output of the following program? #include struct emp_rec { char emp_name[30]; float salary; }; int main() { struct emp_rec emp = {"David", 50000}; printf("%.2f\n", emp.salary); return 0; }
50000.00
50000
Compilation error
Undefined behavior
5.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
What will be the output of the following code? #include struct emp_rec { char emp_name[30]; int attendance[3]; }; int main() { struct emp_rec emp = {"Ethan", {1, 1, 0}}; printf("%d\n", emp.attendance[2]); return 0; }
1
0
Compilation error
Undefined behavior
6.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
What will be the output of the following program? #include struct emp_rec { char emp_name[30]; int attendance[5]; }; int main() { struct emp_rec emp = {"Ethan", {1, 1, 0, 1, 0}}; for (int i = 0; i < 5; i++) { printf("%d ", emp.attendance[i]); } return 0; }
0 1 1 0 1
1 1 0 1 0
0 0 0 0 0
1 0 1 1 0
7.
MULTIPLE CHOICE QUESTION
1 min • 20 pts
What will be the output of the following program? #include struct emp_rec { char emp_name[30]; float salary; }; int main() { struct emp_rec e1 = {"Ava", 65000}; struct emp_rec e2 = e1; printf("%s %.0f\n", e2.emp_name, e2.salary); return 0; }
Compilation error
Ava 65000
Garbage value
Undefined behavior
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
Already have an account?
Similar Resources on Wayground
18 questions
Kiểu dữ liệu xâu kí tự trong Python
Quiz
•
10th Grade - University
20 questions
Linux 3-4
Quiz
•
University
20 questions
C Programming Unit-1 Test-2
Quiz
•
University
20 questions
Java Quiz 1
Quiz
•
University
15 questions
quiz pertemuan 2 asik ddp
Quiz
•
University
20 questions
TEST1.PY
Quiz
•
10th Grade - University
16 questions
De todo
Quiz
•
1st Grade - Professio...
16 questions
Quiz #1
Quiz
•
University
Popular Resources on Wayground
10 questions
Forest Self-Management
Lesson
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
30 questions
Thanksgiving Trivia
Quiz
•
9th - 12th Grade
30 questions
Thanksgiving Trivia
Quiz
•
6th Grade
11 questions
Would You Rather - Thanksgiving
Lesson
•
KG - 12th Grade
48 questions
The Eagle Way
Quiz
•
6th Grade
10 questions
Identifying equations
Quiz
•
KG - University
10 questions
Thanksgiving
Lesson
•
5th - 7th Grade
Discover more resources for Computers
10 questions
Identifying equations
Quiz
•
KG - University
7 questions
Different Types of Energy
Interactive video
•
4th Grade - University
20 questions
HS2C2 AB QUIZIZZ
Quiz
•
1st Grade - Professio...
14 questions
Homonyms Quiz
Quiz
•
KG - University
16 questions
Parts of a Parabola
Quiz
•
8th Grade - University
10 questions
A Brief History of Geologic Time
Interactive video
•
11th Grade - University
15 questions
Black Friday/Cyber Monday
Quiz
•
9th Grade - University
7 questions
Biomolecules (Updated)
Interactive video
•
11th Grade - University
