Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

c++ Exam practice questions

Rating
-
Sold
-
Pages
3
Grade
B
Uploaded on
01-07-2025
Written in
2024/2025

A focused set of beginner-to-intermediate level questions covering key C++ topics like functions, loops, arrays, OOP, and file handling. Perfect for exam prep, assignments, and viva practice.

Institution
Course

Content preview

Practice Question EE-B


Question No. 01
Suppose you are required to build a console-based application that simulates a Smart Parking
Lot Counter System for a small commercial area with a fixed capacity of 10 parking slots. The
purpose of this system is to assist parking attendants in tracking the entry and exit of vehicles in
real-time.

The system should store and manage parking slot data using arrays, where each element represents
a parking slot (1 for occupied, 0 for available). You are required to use pointers to manipulate the
array during parking and un-parking operations. Implement user-defined functions for the
following tasks:
1. Allowing a car to enter (assign a free slot).
2. Allowing a car to exit (free the occupied slot).
3. Displaying the current status of all parking slots.
4. Displaying the number of currently available slots.
5. Searching for a car by a unique token/ID (optional simulated feature).

Each parked car should be assigned a unique parking token or ID, which may be generated using
a built-in function such as rand() if applicable.

The application must be menu-driven, utilizing a switch statement to handle the following
options:

1. Park a car
2. Remove a car
3. View parking lot status
4. Display number of available slots
5. Search for car by token/ID
6. Exit

Additionally, the logic should involve at least one instance, each of for, while, and do-while loops
in appropriate parts of the program. The system should validate inputs (e.g., no over-parking, no
removal from an empty or unassigned slot), ensure a modular program structure using functions,
and provide clear and formatted console output for ease of use.




Engr. Eman Fatima

Written for

Course

Document information

Uploaded on
July 1, 2025
Number of pages
3
Written in
2024/2025
Type
Exam (elaborations)
Contains
Only questions

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
hadiqagulzar

Get to know the seller

Seller avatar
hadiqagulzar NUST College of Electrical & Mechacical Engineering
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
10 months
Number of followers
0
Documents
9
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions