Exploring C Structures, Unions, and Files

Exploring C Structures, Unions, and Files

12th Grade

20 Qs

quiz-placeholder

Similar activities

QUIZ TIK EXCEL

QUIZ TIK EXCEL

10th Grade - University

25 Qs

The Role of IETF & Network Protocols

The Role of IETF & Network Protocols

10th Grade - University

15 Qs

Assesment Awal Informatika Fase - E

Assesment Awal Informatika Fase - E

10th Grade - University

25 Qs

Quiz tentang Google Colab

Quiz tentang Google Colab

10th Grade - University

20 Qs

Cyber 1 Networking FINAL

Cyber 1 Networking FINAL

9th - 12th Grade

20 Qs

Dasar Microsoft Excel

Dasar Microsoft Excel

9th - 12th Grade

20 Qs

G4-Microprocessors and Their Uses

G4-Microprocessors and Their Uses

4th Grade - University

15 Qs

Informatika X Bab 1 Validitas Sumber Data dan Evaluasinya

Informatika X Bab 1 Validitas Sumber Data dan Evaluasinya

10th Grade - University

15 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?