Exploring C Structures, Unions, and Files

Exploring C Structures, Unions, and Files

12th Grade

20 Qs

quiz-placeholder

Similar activities

Networking Quiz

Networking Quiz

12th Grade

15 Qs

QUIZ INFORMATIKA BAB 3

QUIZ INFORMATIKA BAB 3

9th Grade - University

20 Qs

Data flow diagrams

Data flow diagrams

10th Grade - University

16 Qs

LITERASI dIGITAL

LITERASI dIGITAL

12th Grade

25 Qs

Fungsi Input dan Output dalam C

Fungsi Input dan Output dalam C

12th Grade

15 Qs

Penilaian Akhir Semester Informatika

Penilaian Akhir Semester Informatika

9th - 12th Grade

20 Qs

Penyimpanan Cloud

Penyimpanan Cloud

10th Grade - University

20 Qs

Quizz Informatika Analisis Data Kelas 9

Quizz Informatika Analisis Data Kelas 9

9th Grade - University

20 Qs

Exploring C Structures, Unions, and Files

Exploring C Structures, Unions, and Files

Assessment

Quiz

Information Technology (IT)

12th Grade

Hard

Created by

gb thapa

Used 1+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax to define a structure in C?

StructName struct { memberName dataType; };

struct StructName: dataType memberName;

struct StructName { dataType memberName; };

struct { memberName: dataType } StructName;

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you access a member of a structure in C?

Access members using the asterisk operator (*) only.

Use the semicolon operator (;) to access members.

Use the dot operator (.) or the arrow operator (->) depending on whether you have a structure variable or a pointer.

Members can be accessed by their index number like arrays.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary difference between a structure and a union in C?

A structure can hold only one value at a time, while a union can hold multiple values simultaneously.

Structures and unions are identical in functionality and usage.

A structure can only contain primitive data types, while a union can contain complex data types.

A structure can hold multiple values simultaneously, while a union can hold only one value at a time.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you define a union in C?

union union_name { data_type1 member1; data_type2 member2; ... };

enum enum_name { value1, value2, ... };

class class_name { data_type1 member1; data_type2 member2; ... };

struct struct_name { data_type1 member1; data_type2 member2; ... };

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens to the memory allocation of a union when a new member is assigned?

The memory allocation remains the same; it is shared among all members.

The memory allocation is reset to zero when a new member is assigned.

Memory is allocated separately for each member of the union.

The memory allocation increases for each new member assigned.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Can a structure contain a union as a member?

Yes, a structure can contain a union as a member.

No, a union cannot be a member of a structure.

Only classes can contain unions as members.

Structures and unions are mutually exclusive.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the 'sizeof' operator in relation to structures?

The 'sizeof' operator calculates the number of elements in a structure.

The 'sizeof' operator is used to define a structure's members.

The 'sizeof' operator determines the size of a structure in bytes.

The 'sizeof' operator converts a structure to a string representation.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?