Monday, 8 July 2019

CLASS-XII C++ INHERITANCE


ASSIGNMENT OF INHERITANCE

Q1. Consider the following c++ code and answer the questions from (i) to (iv):
class Personal
{
int Class,Rno;
char Section;
protected:
char Name[20];
public:
personal(); void
pentry();
void Pdisplay();
};
class Marks: private Personal
{
float M[5];
protected:
char Grade[5];
public:
Marks();
void Mentry();
void Mdisplay();
};
class Result: public Marks
{
float Total, Agg;
public:
char FinalGrade, comments[20];
Result();
void Rcalculate();
void Rdisplay();
};
(i) Which type of inheritance is shown in the above example?
(ii) Write the names of those data members, which can be directly accessed from the objects of class Result.
(iii) Write the names of those member functions which can be directly accessed from the objects of class Result.
(iv) Write names of those data members, which can be directly accessed from the Mentry() function of class Marks.


Q2. Answer the questions (i) to (iv) based on the following:
class COMPANY
{
char Location[20];
double Budget,Income;
protected:
void Accounts( );
public:
COMPANY();
void Register( );
void Show( );
};
class FACTORY: public COMPANY
{
char Location[20];
int Workers;
protected:
double Salary;
void Computer();
public:
FACTORY();
void Enter( );
void show( );
};
class SHOP: private COMPANY
{
char Location[20];
float Area;
double Sale;
public:
SHOP();
void Input();
void Output();
};
(i) Name the type of inheritance illustrated in the above C++ code.
(ii) Write the names of data members, which are accessible from member functions of class SHOP.
(iii) Write the names of all the member functions, which are accessible from objects belonging to class FACTORY.
(iv) Write the names of all the members, which are accessible from objects of class SHOP.

Q3. Answer the questions (i) to (iv) based on the following:
class FaceToFace
{
 char CenterCode [10] ;
public:
 void Input ( ) ;
 void Output ( ) ;
} ;
class Online
{
 char website [50] ;
public:
 void SiteIn ( ) ;
 void SiteOut ( ) ;
} ;
class Training: public FaceToFace, private
Online
{
 long Tcode ;
 float charge;
 int period;
public:
 void Register ( ) ;
 void Show ( ) ;
} ;
(i) Which type of Inheritance is shown in the above example?
ii) Write names of all the member functions accessible from Show( ) function of class Training.
iii) Wri t e name of all the members accessible through an object of class Training.
iv) Is the function Output( ) accessible inside the function SiteOut( )? Justify your answer.

Q4 Consider the following and answer the questions given below :                               
class Medicine                                                                 
{
char Category[10];
             char Date_of_manufacture[10];
             char Company[20];
             public:
             Medicine();
             void entermedicinedetails();
             void showmedicinedetails();
};
     class capsule:public Medicine
     {
protected:
                                    char capsule_name[30];
char volume_lable[20];
public:
float Price;
capsules();
void entercapsuledetails();
void showcapsuledetails();
     };
     class Antibiotics:public Capsule
     {
 int Dosage_units;
             char side_effects[20];
             int Use_within_days;
      public:
             Antibiotics();
             void enterdetails();
             void showdetails();
     };
     (i)     How many bytes will be required by an object of class Medicines and an object of class Antibiotics respectively?
      (ii)   Write the names of all the member functions accessible from the object of class Antibiotics.
      (iii) Write the names of all the members accessible from member functions of class capsules.
      (iv)  Write names of all the data members which are accessible from objects of class antibiotics.

     Q5. Consider the following and answer the questions given below :                              
   class Dolls
   {
char Dcode[5];
           protected:
                   float Price;
                  void CalcPrice(float);
           public:
           Dolls();
           void DInput();
           void DShow();
   };
   class SoftDolls:public Dolls
   {
char SDName[20];
           float Weight;
           public:
           SoftDolls();
           void SDInput();
           void SDShow();
   };
   class ElectronicDolls:public Dolls
   {
char EDName[20];
           char BatteryType[10];
           int Batteries;
           public:
           ElecronicDolls();
           void EDInput();
           void EDShow();
   };
      (i)     Which type of inheritance is shown in the above example?
      (ii)   How many bytes will be required by an object of the class ElectronicDolls?
      (iii) Write name of all data members accessible from member function of the classSoftDolls.
      (iv)  Write name of member functions accessible an object of the class ElectronicDolls?

      Q6. Consider the following and answer the questions given below :
class Trainer
{
char TNo[5],Tname[20],specialization[10];
int Days;
protected :
float Remuneratoin;
void AssignRem(float);

public:
Trainer();
void TEntry();
void TDisplay();
};
class Learner
{
char Regno[10],LName[20],Program[10];
protected:
int Attendance,grade;
public:
Learner();
void LEntry();
void LDisplay();

};
class Institute : public Learner, public Trainer
{

 char ICode[10],IName[20];
public:
Institute();
void IEntry();
void IDisplay();

};
(i) Which type of inheritance is depicted by above example?
(ii) Identify the member function(s) that cannot be called directly from the objects of class Institute from the following: TEntry(), LDisplay(), IEntry()
 (iii) Write name of all member(s) accessible from member functions of class institute.
 (iv) If class institute was derived privately from class Learner and privately from class Trainer, then name the member function(s)that could be accessed through Objects of class Institute.

Q7.  Consider the following and answer the questions given below :                                                
class toys
{
char tcode[5];
protected:
float price;
void assign(float);
public:
toys();
void tentry();
void tdisplay();
};
class softtoys : public toys
{
char stname[20];
float weight;
public:
softtoys();
void stentry();
void stdisplay();
};
class electronictoys : public toys
{
char etname[20];
int no_of_batteries;
public:
electronictoys();
void etentry();
void etdisplay();
};

(i)     Which type of inheritance is shown in the above example?
(ii)   How many bytes will be required by an object of the class softtoys?
(iii) Write the name of all the data members accessible from member functions of class softtoys?
(iv)  Write the names of all the member functions which are accessible from an object of class electronictoys.










Wednesday, 1 May 2019

Assignment on Text File Handling Class-12




ASSIGNMENT -- TEXT FILE HANDLING
CLASS-12-- COMPUTER SCIENCE


1. Write a user defined function in C++ to read the content from a text file MYbook.txt, count and display the number of blank spaces present in it.

2. Write a menu driven program count the number of uppercase alphabets, lowercase alphabets and alphabets present in a text file “STORY.TXT”.

3. Write a function in C++ to count and display the number of words starting with a vowel present in a given text file “ABC.TXT”.

4.Write a function which reads an already existing file “text1.txt” and write digits (0-9) in to a new text file “DIGIT.TXT” and non digit  into NONDIG.TXT.

5.Write a function in C++ to count the number of lines present in a text file“STORY.TXT”.

6.Assuming that a text file named TEXT1.TXT already contains some text written into it. Write a function named vowelwords(), that reads the file TEXT1.TXT and creates a new file named TEXT2.TXT , which shall contain only those words from the file TEXT1.TXT which don’t start with an uppercase vowel.

7.Write a program that reads a text file and print it on a printer.

8. Write a program that displays the size of a text file in bytes.

9. Write a function in C++ to print the count of the word “is” as an independent word in a text file. DIALOGUE.TXT.

10.Write an interactive C++ program to read a text file and display the following :(i) Frequency table of all the alphabetic characters  (ii)Number of numeric characters present in the file.

11. :Write a program  in C++ to count and display the number of lines starting with alphabet ‘A’ in a text file “MYFILE.TXT”.

Monday, 13 August 2018

QUESTION ANSWERS OF DATABASE CLASS-10



SOLVED QUESTION ANSWERS 
MS-ACCESS
CLASS-X


1.      Explain the term validation rule and validation text?
Ans.  A Validation Rule limits or controls what users can enter in a table field or a control (such as a text box) on a form. 
For example, entering a rule such as >100 And <1000 in the Validation Rule property forces users to enter values between 100 and 1,000.

Validation text is a specialized error message you can set to have Access tell the user entering data the specific way you want that person to enter it. This property is related to the Validation Rule property and is used to specify an error message that will be displayed in case the validation rule is not satisfied.


2.      What is the use of setting input mask?
Ans.  Input mask property is used to control how the data is entered when you have several people entering data in your Access database to help maintain consistency and to make your database easier to manage.  For example, you can set an input mask for a form so that users can only enter telephone numbers in the Swedish format or addresses in the French format.

3.      How is input mask different from format?
Ans. The format property controls the way your data in the field will be displayed whereas input mask controls how the data is entered in a specific field or form.

4.      What do you done by validation? Name two levels at which this is done.
Ans.  Validation/data validation is a method of ensuring that the data is entered into the table is correct and conforms to certain limits and format sets.
The two levels of data validation are:
1.      Field level validation
2.      Record level validation

5.      What is record validation?
Ans. In record validation, the values can be compared in more than a single field when the record is saved.

6.      What should be the setting of required and allow zero length if you want to prevent users from leaving a field blank?
Ans.  Required ---- yes
         Allow zero length----- no

7.      The decimal places property can be set for which type of field is done?
Ans. Number or Currency type.

            8.    What is a query?

Ans.  Query are use to retrieve information or perform actions based on some conditions . It is like to ask question.

9.      What are the different types of number format that can be set?
Ans. The various types of number formats are:
1.      General number
2.      Currency
3.      Euro
4.      Fixed
5.      Standard
6.      Percent
7.      Scientific displays

10.  What methods can be used to create a value list?
Ans.  By using list box and by using combo box.

11.  Name the data types in which the field property allow zero length is available in ms-access.
Ans. Text, memo and hyperlink fields

            12.    What are the different Number field types in Access?
Ans. The different number field types are:
Byte, Integer, Long Integer, Single, Double
13.    What is the meaning of following field properties?
Field Size, Format, Input Mask, Caption, Decimal Places, Default Value,
Validation Rule, Validation Text, Required, Allow Zero Length, Indexed.
Ans.  Field properties and their meaning are described below:
            1.     Field Size: Maximum number of character or value you can enter in field
2.      Format: Format for the field. It gives the layout for the field.
3.      Input Mask: A way or pattern of data to be entered.
4.        Caption: The label for the field
5.      Decimal Places: The number of digits to the right of decimal place.
6.      Default Value: The value automatically entered for the new record.
7.      Validation Rule: An expression that limit the value to be entered in the field.
8.      Validation Text: The message to be displayed while user violates the rule when entering
data.
9.      Required: The data should be entered the field can't be left blank.
10.    Allow Zero Length: Permits zero length of string
11.  Indexed: The field is to be indexed. Indexing speeds up the searching & sorting

14.    What is Lookup Field?
Ans.  A Field that stores a list from an existing table or query or a fixed set of values that is looked up.

            15.    What do you mean by default value for a field in Access table?
Ans.  Default value specifies the value that must be displayed in a particular field when making the data entry. For example you can specify 'Nepal' for the Country field. When entering record the value 'Nepal' will appear automatically and can be modified if required.

Sunday, 23 April 2017

CLASS-XII ASSIGNMENT CH-4 (CLASSES AND OBJECTS)


MAXFORT SCHOOL ROHINI
CLASS-XII
ASSIGNMENT CH-4 (CLASSES AND OBJECTS)



Q1. Write a complete program by considering a class Book with the following specification                                                                                      
Private members of the class Book are –
                Book_No integer ,Book_Title 20 char, Price float , (price per copy)
                Total_Cost ( ) . A function  to calculate the total cost for N numbers of copies, where N is passed to the function as argument.
                Public members of the class Book are –
                INPUT( ) function to read Book_No,Book_Title, Price.
                PURCHASE() function to ask the user to input no. of copies to be purchased. It invokes Total_Cost( ) & prints the total cost to be paid by the user.

Q2. Write a complete program by considering a class TEST in C++ with following description:                                                                                   
Private Members
TestCode of type integer
Description of type string
NoCandidate of type integer
CenterReqd (number of centers required) of type integer
A member function CALCNTR() to calculate and return the number of centers as (NoCandidates/100+1)
Public Members
A function SCHEDULE() to allow user to enter values for TestCode, Description, NoCandidate & call function CALCNTR() to calculate the number of Centres
A function DISPTEST() to allow user to view the content of all the data members

Q3. Write a complete program by considering a class Candidate in C++ with following description:                                                                       
Private Members
·         A data member RNo (Registration Number) of type long
·         A data member Name of type string
·         A data member Score of type float
·         A data member Remarks of type string349
·         A member function AssignRem( ) to assign Remarks as per the Score obtained by a candidate.
Score range and the respective Remarks are shown as follows:
·         Score                                             Remarks
·         >=50                                              Selected
·         less than 50                                Not selected
Public Members
·         A function ENTER ( ) to allow user to enter values for RNo, Name, Score & call function AssignRem( ) to assign the remarks.
·         A function DISPLAY ( ) to allow user to view the content of all the data members.
·          
Q4. Write a complete program by considering a class ITEM in C++ with following description:                                                                  
Private members:
·         Icode of type integer (Item Code)
·         Iname of type string (Item Name)
·         Price  of type Float (Price of each item)
·         Qty of type integer (Quantity in stock)
·         Discount of type float (Discount percentage on the item)
·         A find function finddisc( ) to calculate discount as per the following rule:
o   If Qty <=50 discount is 0%
o   If 50 < Qty <=100 discount is 5%
o   If Qty>100 discount is 10%
Public members:
·         A function Buy( ) to allow user to enter values for Icode, Item, Price, Qty and call function finddisc ( ) to calculate the discount.
·         A function showall ( ) to allow user to view the content of all the data members.

Q5. Write a complete program by considering a class named ADMISSION in C++ with the following descriptions:
Private members:                                                                                                                                                           
AD_NO integer (Ranges 10-2000)
a.       NAME Array of characters(String)
b.      CLASS Character
c.       Fees Float
Public members:
a.       Function Read_Data() to read and object of Admission type
b.      Function Display() to display the details of an object
c.       Function Draw_Nos() to choose 2 students randomly and display the details. Use random function to generate admission nos. to match with AD_NO.
Q6. Write a complete program by considering a class employee with the following specifications:
            Private members
            empno                         integer type
            ename                         20 character
            basic,hra,da                float
            netpay                        float
         ctotal( )                         A function to calculate the total as basic+hra+da with float return type.
            Public members:
         takedata ( )                function to read empno, ename,basic,hra,da and invoke ctotal( ) to calculate total.
         showdata ( )              to display all the data members on the screen.

Q7.     Write a complete program by considering a class worker with the following specification:
            Private members
                        Wno                           integer
                        wname                     20 character
                hrwrk,wgrate      float (hours worked and wagerate per hour)
                totwage               float (hrwrk * wgrate)
               calwg( )              A function to calculate the totwage  with float return type.
            Public members:
                     takedata ( )    function to reed wno, wname ,hrwrk, wgrate and invoke calwgl( ) to calculate total wages.
                     showdata ( ) function to display all the data members on the screen.




Thursday, 3 November 2016

CLASS-XII STACKS AND QUEUES




PRACTICAL PROGRAMS 
ON
STACKS AND QUEUES



1. Write a menu driven program in C++ to perform insert, delete and display operation on a dynamically allocated queue containing passanger details. consider the following definition of node in the code.


struct node
{
long pno;
char pname[20];
node *next;
};


2. Write a menu driven program in C++ to perform insert, delete and display operation on a dynamically allocated stack containing book details. Consider the following definition of node in the code.

struct node
{
char book_no;
char book_titla[20];
node *next;
};




Thursday, 20 October 2016

Class-XI Programs On While Loop



PRACTICAL QUESTIONS ON WHILE LOOP


     1.       Write a program to enter an integer number and print the series upto n numbers in a given format.
1              2              3              .               .               .               .               n

     2.       Write a program to print all characters from 0 to 255.
     3.       Write a program to enter a decimal number and convert it into binary number.
     4.       Write a program to enter a binary number and convert it into decimal number.
    5.       Write a program to enter a positive integer number and count the total number of digits and sum of digits.
    6.       Write a program to find the factorial of a number.
    7.       Write a program to display the Fibonacci series.
    8.       Write a program to display the hailstone series.
    9.       Write a program to display the Lucas series.
    10.   Write a program to enter an integer number and check if it is a palindrome or not.
    11.   Write a program to enter an integer number and check if it is Armstrong number or not.
    12.   Write a program to enter the lower limit and upper limit of a number and calculate the sum of all numbers in the given limit.
    13.   Write a program to enter a positive integer number and print the table.
    14.   Write a program to enter a number and generates its cube.
    15.   Write a program to count the total even and odd numbers in a given range.
    16.   Write a program to enter a number and check if it is prime number or not.