LearnFrenzy
Sign in Take a free test

Structures, Unions, Enums · Exercise 4 of 4

Structures, Unions, Enums Structure Programs

  • 8 questions
  • Page 1 of 1
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Practical programs with structures, unions and enums. Write each one yourself first, then open the solution – every solution was compiled and run, and the output shown is the real output.

Question 1 Easy

Store student records in an array of structures and print the student with the highest CGPA.

Question page & discussion
Question 2 Easy

Represent a point as a structure and write a function that returns the distance between two points.

Question page & discussion
Question 3 Medium

Add two durations stored as hours, minutes and seconds, carrying over correctly.

Question page & discussion
Question 4 Hard

Implement a singly linked list with append, delete-by-value and print, and free all nodes at the end.

Question page & discussion
Question 5 Medium

Sort students by marks (highest first); students with equal marks go in alphabetical order.

Question page & discussion
Question 6 Hard

Print the raw 32-bit pattern of some float values, and split it into sign, exponent and mantissa.

Question page & discussion
Question 7 Medium

Model a traffic light with an enum and a function that returns the next state, and print the sequence for 5 steps starting from red.

Question page & discussion
Question 8 Medium

Write deposit and withdraw functions for an account structure that refuse invalid operations and report why.

Question page & discussion
All exercises doneBack to Structures, Unions, EnumsRevise the concepts or pick another topic

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links