Professional Documents
Culture Documents
2. a. Write a C program to deIine a class called patient` (name, age, sex). Derive two classes
Irom patient` namely in-patient` (ipno, date-oI-adm, date-oI-discharge) and out-patient`(opno
,doctor-id, consultation-Iee. DeIine two classes namely general-ward`(rent / day) and special-
ward`(roomno, rent/day, eb-bill). For out-patient print the bill with consultation-Iee. For in-
patients, print bill According to their accommodation either in general-ward or special-ward.
(10)
(or)
b. Explain Dijikstra`s Algorithm and solve the single source shortest path problem. Assume
as the source vertex. (10)
3. a. What is a Iile mode? Describe the various Iile mode options available with proper examples.
(10)
(or)
b. Explain the algorithm oI Quicksort by sorting the Iollowing set oI numbers
as an example: 42 47 52 57 62 37 32 27 22 (10)
4. a. Compare and contrast Insertion-sort and Shell-sort. (10)
or
b. What is an exception? How is an exception handled in C? (10)
5 a . Explain the various Iorms oI inheritance in C with necessary coding. (10)
or
b. DeIine a class string`. Use overload ` operator to compare two strings (10)