Computer Practical File Questions
Computer Practical File Questions
Computer Practical File Questions
A class telcall calculates the monthly phone bill of a consumer. Some of the members of the
class are: -
Class name: telcall
Data Members: i) phno = No. Of Consumer
ii) name = Name of Consumer
iii) n = No. Of calls made (Integer)
iv) amt = Bill Amount
Member Functions / Methods: -
telcall (int x , string y , int k) = Parameterized constructor to assign details & value to
data members.
void compute( ) = To calculate the amount of bill according to the criteria given
below.
void display( ) = To display the details in specified format.
Specify the class digit, giving the details of functions, void extraction() and void
display( ). Define a main function & create an object and call the member methods to
enable the task.
Program – 3
A class function defines to calculate the result of the relation: -
Data Members:
Function( ) = Default constructor to assign value to data members.
void readnum( ) = To return the factorial of argument ‘d’.
void show( ) = To display the value of ‘F’ by invoking the function int factorial
(int d).
Specify the class function , giving the details of constructor , functions , void
readnum( ) , int factorial (int d) and void show( ).
Define a main function to create an object & call the methods accordingly to enable the
task.
Program – 4
A class string is to declare to perform string related operations. The details of the class are
given below.
Class name: string
Data Members: I) str - To store a string.
II) rev - To store the reverse of the string
III) s - Integer to store spaces.
IV) w - Integer to store words.
Member functions:
string( ) = Constructor to store legal initial values to data members.
void inputstr( ) = To read a string str from input. The words in the string can be
separated by one or more blank spaces.
void getrev ( ) = To store the reverse of of the string stored in str into rev terminated
by full stop. Do not use reverse() function. Print the original string and the reverse
string.
void count ( ) = To count and print total no of spaces and total no of words from the
original str.
Specify the class string, giving details of the constructor functions void inputstr(), void
getrev ( ) , void getstr( ) and void count( ) . Also write a main () function to create the
object and invoke the methods.
Program – 5
A class process has been defined to count vowels and consonants. The details of the
class are given below: -
sky 0 3
is 1 1
blue 2 2
Specify the class process, giving details of the constructors, functions void
changecase() and void countletters(). Also, write a main () function to create the
object and invoke necessary methods to enable the tasks.
Program – 6
Input a word in uppercase and check for the position for the first occurring vowel and
perform the following operations:
(i) Words that begins with a vowel are concatenated with "Y".
(ii) Words that contain a vowel in-between should have the first part from the position
of the vowel till end followed by the part of the string from beginning till position of
the vowel and is concatenated with C.
(iii) Words that do not contain a vowel are concatenated with "N".
Member functions/methods:
Specify the class and rearrange giving details of the constructor, functions void
readword(), void convert() and void display(). Write a main() function to create an
object and call the function to enable the task.
Program – 7
A class TheString accepts a string of maximum of 100 characters with only one blank
space between the two words. Some of the members of the class are given below:-
Member functions/methods:-
A 2
B 1
H 1
I 2
L 2
S 1
T 1
Specify the class TheString, giving details of the constructors and function void printFreq().
Define a main function to create the object and call the methods to enable the task.
Program – 8
The strength of uppercase letters is measured as: A = 1 , B = 2 , C = 3 , D = 4 ..... Z=26
The potential of a word is measured by adding the strength of each alphabet in the word. For
Example:
INPUT: BEST, its potential = 2+5+19+20 = 46
(as B = 2 , E = 5 , S = 19 & T = 20)
Design a class Strength with the following details: -
Class name: Strength
Specify the class Strength giving details of the constructor , functions void
readStr( ), void show( ) & void Potential( ). Define a main( ) function to create
the object and call the methods accordingly to enable the task.
Program – 9
A class PrimeFact generates all the prime factors of a positive integer greater than
0.
For Example: If the number is 24, then its prime factors will be: 2, 2, 2, 3. If the
number is 11, its prime factors will be: 11.
Member functions/methods : -
PrimeFact( ) : Constructor to initialize the data members with initial values.
void Accept( ): To input the value of the data member num.
void generateFacts( ): To generate and print all the prime factors of 'num' and
also store the sum of all the prime factors to the data member 'sum'.
void print( ): To display the original number and the sum of prime factors.
Specify the class PrimeFact, giving details of the constructor, functions void
Accept(), void generateFacts() and void Print(). Define a main() function to
create the object and call the methods accordingly to enable the task.
Program – 10
A class sort contains an array of 50 integers. Some of the member functions and data
members are given:
Member functions/methods: -
Specify the class sort giving details of the functions void inpdata( ), void bubsort()
and void binsearch( ). Define main() function to create an object and call the methods
to enable the task..