0% found this document useful (0 votes)
144 views7 pages

File Assignment 1. Chap Functions

1) The document provides questions on functions from past board papers ranging from 2005-2016. 2) It includes questions involving classes, objects, methods for input, calculation and display of data related to employees, students, books etc. 3) The questions require defining classes with data members and member functions to calculate values, read input, and display output.

Uploaded by

Sagarika Badgi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
144 views7 pages

File Assignment 1. Chap Functions

1) The document provides questions on functions from past board papers ranging from 2005-2016. 2) It includes questions involving classes, objects, methods for input, calculation and display of data related to employees, students, books etc. 3) The questions require defining classes with data members and member functions to calculate values, read input, and display output.

Uploaded by

Sagarika Badgi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

FILE ASSIGNMENT QUESTIONS ON FUNCTIONS.

Please write make one separate file you may take printouts of
questions, solve every program after question. Comments,
variable table is compulsory. Neat and tidy work is expected.
As this work will be submitted to board for internal
assessment.
(Generally it is question no 4 in board paper)
(Board paper 2005)
Q1. Write a class with name employee and basic as its data member,
to find the gross pay of an employee for the following allowances
and deduction.
Use meaningful variables. And input( ) calculate( ) and display( )
followed by main( ) function.
Dearness Allowance = 25% of the Basic Pay
House Rent Allowance = 15% of Basic Pay
Provident Fund = 8.33% of Basic Pay
Net Pay = Basic Pay + Dearness Allowance + House Rent
Allowance
Gross Pay = Net Pay − Provident Fund [15 marks]

(Board paper 2006)


Q. 2 Write a program to calculate and print the sum of odd numbers and
the sum of even numbers for the first n natural numbers. The
integer n is to be entered by the user. [15 marks]
Q. 3 Write a program that outputs the results of the following
evaluations based on the number entered by the user. (hint : use
maths functions)
(1) Natural logarithm of the number
(2) Absolute value of the number
(3) Square root of the number
(4) Random numbers between 0 and 1. [15marks]

(Board paper 2007)


Q. 4 Define a class salary described as below:-
Data Members : Name, Address, Phone, Subject Specialization, Monthly
Salary, Income Tax.
Member methods :
(1) To accept the details of a teacher including the monthly salary.
(2) To display the details of the teacher.
(3) To compute the annual Income Tax as 5% of the annual
salary above Rs.1,75,000/-.
Write a main method to create object of a class and call the above
member method. [15 marks]

(Board paper 2008)


Q. 5 Define a class Employee having the following description : [15marks]
Instance variables :
int pan to store personal account number
String name to store name
double tax income to store annual taxable income
double tax to store tax that is calculated
Member functions :
input ( ) Store the pan number, name, taxable income
calc( ) Calculate tax for an employee
display ( ) Output details of an employee
Write a program to compute the tax according to the given
conditions and display the output as per given format.
Total Annual Taxable Income Tax Rate
Upto Rs, 1,00,000 No tax
From 1,00,001 to 1,50,000 10% of the income exceeding Rs. 1,00,000
From 1,50,001 to 2,50,000 Rs. 5000 + 20% of the income exceeding Rs.
1,50,000
Above Rs. 2,50,000 Rs. 25,000 + 30% of the income exceeding Rs.
2,50,000
Output :
Pan Number Name Tax-income Tax
_______ ______ _____ ___ __
(Board paper 2009)
This kind of question was not asked.
(Board paper 2010)
Q. 6 Define a class student described as below:
Data Members / instance variables :
Name, age, m1, m2, m3 (marks in 3 subjeects), maximum, average
Member Methods:
(1) A parameterized constructor to initialize the data members
(2) To accept the details of student
(3) To computer te averae and the maximum out of three marks
(4) To display the name, age, marks in three subjects, maximum and
average.
Write a main method to create an obhect of class and call the above
member. [15 marks]
(Board paper 2011)
Q. 7 Define a class called mobike with the following description:
Instance variables/data members:
int bno -to store the bike’s number
Int phno -to store the phone number of the customer
String name -to store the name of the customer
Int days -to store the number of days the bike is taken on rent
Int charge - to calculate and store the rental charge

Member methods:
Void input() - to input and store the detail of the customer
Void compute() -to compute the rental charge.
The rent for a mobike is charged on the following basis.
First five days Rs. 500 per day.
Next five days Rs. 400 per day.
Rest of the days Rs. 200 per day.
void display() to display the details in the following format:
Bike No. Phone No. No. of days Charge
--------- ------------ ------------- --------
(Board paper 2012)

Q. 8 Define a class called Library with the following description:


Instance variables/data members:
Int acc_num – stores the accession number of the book
String title – stores the title of the book stores the name of the author
Member Methods:
(i) void input() – To input and store the accession number, title and
author.
(ii)void compute – To accept the number of days late, calculate and
display and fine charged at the rate of Rs.2 per day.
(iii) void display() To display the details in the following format:
Accession Number Title Author
Write a main method to create an object of the class and call the above
member methods. [15 marks]
(Board paper 2013)

Q. 9 Define a class called FruitJuice with the following description:


[15]
Instance variables/data members:
int product_code – stores the product code number
String flavour – stores the flavour of the juice.(orange, apple, etc)
String pack_type – stores the type of packaging (tetra-pack, bottle etc)
int pack_size – stores package size (200ml, 400ml etc)
int product_price – stores the price of the product
Member Methods:
FriuitJuice() – default constructor to initialize integer data members
to zero and string data members to “”.
void input() – to input and store the product code, flavour, pack type,
pack size and product price.
void discount() – to reduce the product price by 10.
void display() – to display the product code, flavour, pack type,
pack size and product price.

(Board paper 2014)

Q. 10 Define a class named movieMagic with the following


description:
Instance variables/data members:
int year - to store the year of release of a movie
String title - to store the title of the movie.
float rating - to store the popularity rating of the movie.
(minimum rating = 0.0 and maximum rating = 5.0)
Member Methods:
(i) movieMagic() Default constructor to initialize numeric
data members to 0 and String data member to “”.
(ii) void accept() To input and store year, title and rating.
(iii) void display() To display the title of a movie and a
message based on the rating as per the table below.
Rating Message to be displayed
0.0 to 2.0 Flop
2.1 to 3.4 Semi-hit
3.5 to 4.5 Hit
4.6 to 5.0 Super Hit

Write a main method to create an object of the class and call the above
member methods. [15 marks]

(Board paper 2015)


Q. 11 Define a class called ParkingLot with following description:
Instance variables / data members:
int vno – To store the vehicle number
int hours – To store the number of hours the vehicle is parked in the
parking lot.
double bill : To store the bill amount
member methods:
void input( ) – To input and store the vno and hours.
void calculate( ) – To compute the parking charge at the rate of Rs.3 for
the first hour or part thereof, and Rs. 1.50 for each additional hour or
part thereof.
void display( ) – To display the detail.
Write a mian method to create an object of the class and call the above
methods.

(Board paper 2016)


Define a class BookFair with following description
Instance variables data members:
String Bname : Stores the name of the book
double price : Stores the price of the book
Member methods:
1) BookFair() : default constructor to initialize the data members
2) void Input() : To input and store the name and price of the book
3) void Calculate(): To calculate the price after the discount. Discount
is calculated based on the following criteria.
Price Ddiscount
Less than or equal to ₹1000 2% of price
More than ₹ 1000 and less than or equal to ₹ 3000 10% of price
More than ₹ 3000 15% of price

4) void display() : To display the name and price of the book after discount.

Write a main method to create an object of the class and call the above member
methoids.

You might also like