Tuesday, October 20, 2015

ASSIGNMENT -- DATA FILE HANDLING PART 2

DATA FILE HANDLING PART 2

Q 12    Following is the structure of each record in a data file named “Colony.dat”                                               
struct Colony
{
            char colony_code[10];
            char colony_name[10];
            int no_of_people;
};
            Wite a function to update the file with a new value of No_of_people. The value of colony_code and no_of_people  are read during the execution of the program.

Q 13     Assuming the class ZOO given below, write functions in C++ to perform following:
i.                    Write the objects of ZOO to a binary file.
ii.                  Read the objects of ZOO from binary file and display them on screen.
            class ZOO
            {
                        char location[20];
                        int no_of_animals[10];
                        public:
                                    void readdata()
                                    {
                                                cin>>location;
                                                gets(no_of_animals);
                                    }
                                    void writedata()
                                    {
                                                cout<
                                    }

            };                                                                     

ASSIGNMENT -- DATA FILE HANDLING

ASSIGNMENT – FILE HANDLING  CLASS XII A
Q1 Write a function count in C++ to count the no. of spaces in a text file “ memo.txt”.

Q2 Write a function count in C++ to count the no. of vowels  in a text file “ memo.txt”.

Q 3 Write a function count in C++ to count the presence of a word ‘do’ in a text file “ memo.txt”.

Q4 Write a function count in C++ to count and display  the no. of   lines start with ‘A’ in a file   “ school.txt”.

Q 5 Given a binary file game.dat which has following  structure type data
Struct game
{           int gcode; 
char gname[20];
char no_of_participant;
  }
(1) write a function that would copy those structures from game.dat to cricket.dat where gname is ‘cricket’.
(2) write a function that would update the value of no_of_participant in the file game.dat.

Q 6 Given a binary file phone.dat which has following  class type data
Class phonelist
{        char name[20];
char address[30];
char acode[5];
char pno[15];
public:
void register();
void show();
int checkcode(char ac[])
{
            return strcmp(areacode,ac);
}    
};
write a function that would copy those objects from phone.dat to phoneback.dat where acode is “del”.

Q 7 void main()
{       char ch=’A’;
       fstream file(data.dat”,ios::app);
        file<
        int p=file.tellg();
       cout<
}
what will be the output if the file content before the execution of the program is the string “ABC” (Note that “”are not the part of the file)


Q8 Given the binary file ITEM.DAT, containing the records of the following structure:  
struct item
{
int item_no;
char item_name[20];
int stock;
};
Implement the function AddStock( item x, int n), which updates a record by adding the existing stock for the item x in the file.


 Q 9 Write a function in c++ to read and display the records of computers that cost more than Rs. 20000 from the binary file “COMP.DAT”, assuming that the binary file is containing the objects of the following class :                                           
                                    class COMPUTER
                                                { int srno;
                                                char model[25];
                                                float price;
                                                public:
                                                            float Retpr( ) { return price; }
                                                            void Enter( ){ cin>>srno>>price; gets(model); }
                                                            void Display( ){ cout<

      Q 10  Write a function RevText() to read a text file “ Input.txt “ and Print each word in reverse   order .                                                                                                                   
               Example                    If value in text file is : INDIA IS MY COUNTRY
                                                    Output will be : AIDNI SI YM YRTNUOC

Q 11 Write a function in C++ to search for BookNo from a binary file “BOOK.DAT”, assuming the binary file is contained the objects of the following class:             
class BOOK
            {
                        int Bno; char Title [20];
                        public :
                        int Rbno ( ) { return Bno; }
                        void Enter ( ) { cin >> Bno; gets (Title); }
                        void Display ( ) { cout << Bno <<p class="MsoNormal">             };</p> <p class="MsoNormal"> <o:p> </o:p></p> <p class="MsoNormal" style="text-align:justify"> Q 12    Following is the structure of each record in a data file named “Colony.dat”                                                </p> <p class="MsoNormal" style="margin-left:1.0in;text-align:justify"> struct Colony</p> <p class="MsoNormal" style="margin-left:1.0in;text-align:justify"> {</p> <p class="MsoNormal" style="margin-left:1.0in;text-align:justify">             char colony_code[10];</p> <p class="MsoNormal" style="margin-left:1.0in;text-align:justify">             char colony_name[10];</p> <p class="MsoNormal" style="margin-left:1.0in;text-align:justify">             int no_of_people;</p> <p class="MsoNormal" style="margin-left:1.0in;text-align:justify"> };</p> <p class="MsoNormal" style="text-align:justify">             Wite a function to update the file with a new value of No_of_people. The value of colony_code and no_of_people  are read during the execution of the program.</p> <p class="MsoNormal"> <o:p> </o:p></p> <p class="MsoNormal"> Q 13     Assuming the class ZOO given below, write functions in C++ to perform following: </p> <p class="MsoNormal" style="margin-left:1.25in;text-indent:-.5in;mso-list:l0 level2 lfo1; tab-stops:list 1.25in"> <!--[if !supportLists]-->i.<span style="font-stretch: normal; font-size: 7pt;">                    </span><!--[endif]-->Write the objects of ZOO to a binary file.</p> <p class="MsoNormal" style="margin-left:1.25in;text-indent:-.5in;mso-list:l0 level2 lfo1; tab-stops:list 1.25in"> <!--[if !supportLists]-->ii.<span style="font-stretch: normal; font-size: 7pt;">                  </span><!--[endif]-->Read the objects of ZOO from binary file and display them on screen.</p> <p class="MsoNormal">             class ZOO</p> <p class="MsoNormal">             {</p> <p class="MsoNormal">                         char location[20];</p> <p class="MsoNormal">                         int no_of_animals[10];</p> <p class="MsoNormal">                         public:</p> <p class="MsoNormal">                                     void readdata()</p> <p class="MsoNormal">                                     {</p> <p class="MsoNormal">                                                 cin>>location;</p> <p class="MsoNormal">                                                 gets(no_of_animals);</p> <p class="MsoNormal">                                     }</p> <p class="MsoNormal">                                     void writedata()</p> <p class="MsoNormal">                                     {</p> <p class="MsoNormal">                                                 cout<<location<<” ”<<no_of_animals<<endl;</p> <p class="MsoNormal">                                     }</p> <p class="MsoNormal"> </p> <p class="MsoNormal">             };                                                                     </p> </div>

Assignment : ARRAY

                                     ASSIGNMENT : ARRAY

1 An array A [20][20] is stored in the memory along the column with each of the Element require 4 bytes. Find the address of A[10][12], if A[1][1] is stored in           location 1000.               
  2  Write a user defined function in C++  which accept a one d array and its size as argument and divide all the elements by 5 which are dividible by 5 and multiply other elements by 7.             

3 Two dimensional array ARR[8][7] having real numbers(double), is stored in the memory along the row, find out the memory location for the element ARR[2][4], if an element ARR[1][5] is stored at the memory location 1000.                 

4  An array S[40][30] is stored in the memory along the row with each of the element occupying 4 bytes, find out the memory location for the element S[15][5], if an element s[20][10] is stored at memory location 5700.                                                                                                                                                
5 Write UDF in C++ which accepts an integer array and its size as arguments/ parameters and assign the elements into a 2 D array of integers in the following format:
            If the array is 1,2,3,4,5.
             The resultant 2D array is given below
            1 0 0 0 0
            1 2 0 0 0
            1 2 3 0 0
            1 2 3 4 0
            1 2 3 4 5                                                                                                                                
6  Write UDF in C++ to print the row sum and column sum of a matrix.                                                                                            
7          An  array P[20][30] is stored in the memory along the column with each of the element occupying 4 bytes, find out the memory location for the element P[5][15], if an element P[2][20] is stored at the memory location 5000.                                   


8          Write a function in C++ which accepts a integer  array and its size as an
 arguments and arrange the array in reverse

 if initially array is
     4,2,5,1,6,7,8,12,10

The final array will be
    10,12,8,7,6,1,5,2,4

9          Write a function in C++ which accepts a integer  array and its size as an
 arguments and prints the output (using nested loops) in following format :
Example : if the array is having
1 2 4 5 9

Then the output should be 
1
2 2
4 4 4 4
5 5 5 5 5
9 9 9 9 9 9                                                                                          
10  An array A[10][20] is stored in the memory with each element occupying 2 bytes of storage. If the Base address of array in the memory is 800 , determine the location of A[9][10] when the array is stored as (i) Row Major (ii) column major.

11        Write a function in C++ to merge the contents of two sorted arrays A & B into third array C. Assuming array A is sorted in ascending order, B is sorted in descending order, the resultant array is required to be in ascending order.                                                                                                                                                                                      
12 Assume an array S of structure Student is to be arrange in descending order of marks. Write a function which will accept the required array and its size as argument and arrange the same with bubble sort.
The given structure is-
Struct Student
{
            Int rno;
            Char name[];
            Float marks;
};                                                         

Saturday, October 17, 2015

Assignment Linked list , stack , queue

ASSIGNMENT STACK QUEUE LINKED LIST


  1.   (A) Evaluate the following postfix notation of expression:                                                                            
20,30,+,50,40,-,*

(B) Write a function in C++ to perform Insert operation in a dynamically allocated Queue   
      containing names of students.           

   2     (A)  Write a function in C++ to delete a node containing names of student ,
from a dynamically allocated Queue of names implemented with the help
of following structure :                                                                            
struct student
{
            char name[20];
            student *next;

}*front , *rear;
(b)          Consider the following portion of a program , which implements a linked  stack for Library . Write the definition of function PUSH(),to insert a new node in the stack with required information                                              
struct Library
{         
           int id;
            char names[20];
            Library * next;           
};
class stack
{
            Library *top;
            public :
stack()
            {
            top=NULL;    
}
            void PUSH();
            void POP();
};
(c)          Convert the following infix expression into postfix. show the stack status
 after execution of each operation:                                                          
TRUE OR   FALSE AND   NOT    FALSE   OR  FALSE

3   (A)  Write a function in C++ to perform Push operation on a dynamically allocated Stack containing real numbers.                                                                                                                                                  
(b)  Evaluate the following postfix notation of expression:                                                                        
True, False, AND, True, True, NOT, OR, AND

 4. A ) Consider the following program for linked QUEUE:                                                   
struct NODE
{ int x;

float y;
NODE *next; };

class QUEUE
{ NODE *R,*F;;
 public :
            QUEUE( )
            {
             R=NULL;
             F=NULL;
           }

void INSERT( );
void DELETE( );
void Show( );
~QUEUE( ); };
            Define INSERT( ) & DELETE( ) functions outside the class.

 B ) Evaluate the following postfix expression using stack and show the contents after
execution of each operations                                                                                470,5,4,^,25,/,6,*,+,81,- 


 5.  (A) Define function stackpush( ) to insert nodes and stackpop( ) to delete nodes, for a linklist implemented stack having the following structure for each node:
            struct Node
            {           char name[20];        
                        int age;
                        Node *Link;
            };
            class STACK
            {           Node * Top;
                        Public:
                        STACK( ) { Top=NULL;}
                        void stackpush( );
                        void stackpop( );
                        ~STACK( );
            };                                                         
(B) Evaluate the following postfix expression using a stack and show the contents of stack after execution of each operation:
TRUE,FALSE, TRUE FALSE, NOT, OR, TRUE , OR,OR,AND






Saturday, March 28, 2015

WELCOME CLASS XII SESSION 2015-16

WELCOME TO MY DEAR STUDENTS OF CLASS XII

 FOR SESSION 2015-16.


BE READY TO ACHIEVE YOUR GOALS.


I CAN DO........
I WILL DO.............

Thursday, January 15, 2015

CBSE Practical Examination Pattern Session 2014-15

COURSE DESIGN

Class XII (Practical) -- C++
Duration: 3 hours                                                                  Total Marks: 30
1. Programming in C++                                                                    12 marks
One programming problem in C++ to be developed and tested in Computer during the examination. Marks areallotted on the basis of following:
Logic :                                                 7 Marks
Documentation/Indentation :              2 Marks
Output presentation :                          3 Marks
Notes: The types of problem to be given will be of application type from the following topics
·          Arrays (One dimensional and two dimensional)
·          Class(es) and objects
·          Stack using arrays and or linked implementation
·          Queue using arrays (circular) and or linked implementation
·          Binary File operations (Creation, Displaying, Searching and modification)
·          Text File operations (Creation, Displaying and modification)

2. SQL Commands                                                                            05 marks
Five Query questions based on a particular Table / Reaction to be tested practically on Computer during the examination. The command along with the result must be written in the answer sheet.

3. A digital circuit design (after reduction using K-map) to be given during the examination. The question must be written in the answer sheet   02 marks

4. Project Work                                                                                 05 marks
The project has to be developed in C++ language with Object Oriented Technology and also should have use of Data files. (The project is required to be developed in a group of 2-4 students)
·         Presentation on the computer
·         Project report (Listing, Sample, Outputs, Documentations)
·         Viva
5. Practical File                                                                                  03+01*4 marks
               Must have minimum 20 programs from the following topics
 Arrays (One dimensional and two dimensional, sorting, searching, merging, deletion' & insertion of elements)
Class(es) and objects
Stacks using arrays (linear and circular) and linked implementation
File (Binary and Text) operations (Creation, Updation, Query)
Any computational Based problems

              20 SQL commands along with the output based on any table/relation:

              4 logic circuit diagrams

6. Viva Voce                                                                                       02 marks

Viva will be asked from syllabus covered in class XII and the project developed by student.


* 1 Mark for innovation in practical file 

ASSIGNMENT INHERITANCE

ASSIGNMENT INHERITANCE