CBSE Computer Science Question papers for 12th Standard CBSE Question paper & Study Materials

12th Standard CBSE Computer Science Public Exam Model Question 2020 - by Ekta Bhalla - Kottayam View & Read

  • 1)

    Evaluate the following C++ expressions, where a,b and c are integers and d,f are floating point numbers. The values are: a=5,b=3 and d=1.5
    i) c=a-(b++)*(--d)
    ii)f=(++b)*b-a

  • 2)

    What is wrong with the following C++ statement?
    long float y;

  • 3)

    Evaluate the following C++ expression for x=10, y=5 and z=11
    (x==y)||(!(z==y))&&(z<x)

  • 4)

    What is the effect of absence of break in switch-case statement?

  • 5)

    Observe the following C++ code and write the name(s) of the header file(s),which will be essentially required to run it in a C++ compiler.
    void main()
    {
        int Number;
        cin>>Number;
    if(abs(Number)==Number);
        cout<<"Positive"<<endl;
    }

12th Standard CBSE Computer Science Public Exam Sample Question 2020 - by Ekta Bhalla - Kottayam View & Read

  • 1)

    What is wrong with the following C++ statement?
    long float y;

  • 2)

    Do you see any similarity between a typedef name and a reference name? If yes, what is it?

  • 3)

    Which value of x will be printed in following case and why?
    int x=9;
    void main()
    {
      int x = 10;
      cout<<x;
    }

  • 4)

    Observe the following C++ code and write the name(s) of the header file(s), which will be essentially required to run it in a C++ compiler.
    void main()
    {
        char Text[20],C;
        cin>>Text;
        C=tolower(Text[0]);
        cout<<c<<"is the first char of"<<Text<<endl;
    }

  • 5)

    Write the names of the header files to which the following belong: i) puts()  ii) sin()

12th Standard CBSE Computer Science Public Exam Important Question 2019-2020 - by Ekta Bhalla - Kottayam View & Read

  • 1)

    Evaluate the following C++ expressions, where a,b and c are integers and d,f are floating point numbers. The values are: a=5,b=3 and d=1.5
    i) c=a-(b++)*(--d)
    ii)f=(++b)*b-a

  • 2)

    What is wrong with the following C++ statement?
    long float y;

  • 3)

    Differentiate between an identifier and keywords.

  • 4)

    Show two different ways to declare as integer variable named intname and set its value to 15.

  • 5)

    What is the effect of absence of break in switch-case statement?

12th Standard Computer Science Board Exam Sample Question 2020 - by Ekta Bhalla - Kottayam View & Read

  • 1)

    Write the difference between = and ==

  • 2)

    How is an entry controlled loop different from exit controlled loop?

  • 3)

    How many times is the loop executed?
    int i=0, j=0;
    do
    {
        i=j;
    }
    while(j<5);

  • 4)

    When will you make a function inline?

  • 5)

    What are nested structures? Give an example.

12th Standard computer Science Board Exam Model Question 2019-2020 - by Ekta Bhalla - Kottayam View & Read

  • 1)

    How 'I' operator is different from '%' operator?

  • 2)

    Differentiate between an identifier and keywords.

  • 3)

    How many times is the loop executed?
    int i=0, j=0;
    do
    {
        i=j;
    }
    while(j<5);

  • 4)

    Observe the following C++ code and write the name(s) of the header file(s),which will be essentially required to run it in a C++ compiler.
    void main()
    {
        int Number;
        cin>>Number;
    if(abs(Number)==Number);
        cout<<"Positive"<<endl;
    }

  • 5)

    Which C++ header file(s) will be essentially required to be included to run/execute the following C++ code?
    void main()
    {
          int Eno_123;
          char Ename[]="RehanSwarop";
         cout<<setw(5)<<Eno_123<<setw(25)<<EName<<endl;
    }

12th Standard CBSE Computer Science - Database and SQL Six Mark Question Paper - by Sunil Sharma - Puducherry View & Read

  • 1)

    Write SQL queries for (a) to (f) and write the output for the SQL queries mentioned in (g) parts (i) to (iv) on the basis of tables ITEMS and TRADERS.
    TABLE: ITEMS

    code IName Qty price company Tcode
    1001 DIGITAL PAD 121 120 11000 XENITA T01
    1006 LED SCREEN 40 70 38000 SANTORA T02
    1004 CAR GPS SYSTEM 50 2150 GEOKNOW T01
    1003 DIGITAL CAMERA 12X 160 8000 DIGICLICK T02
    1005 PEN DRIVE 32 GB 600 1200 STOREHOME T03

    TABLE: TRADERS 

    Tcode TName City
    T01 ELECTRONIC SALES MUMBAI
    T03 BUSY STORE CORP DELHI
    T02 DISP HOUSE INC CHENNAI

    (a) To display the details of all the items in ascending order of item names(i.e. INAME).
    (b) To display item name and price of all those items whose price is in the range of 10000 nd 22000(both values inclusive)
    (c) To display the number of items, which are traded by each trader. The expected output of this query should be:

    T01 2
    T03 1
    T02 2

    (d) To display the Price, item name(ie.name) and quantity(ie.Qty) of those items, which have quantity more than 150.
    (e) To display the names of those traders, who are either from DELHI or from MUMBAI.
    (f) To display the name of the companies and the name of the items in descending order of company names.
    (g) Obtain the outputs of the following SQL queries based on the data given in the tables ITEMS and TRADERS above.
    (i) SELECT MAX(Price), MIN(Price) FROM ITEMS;
    (ii) SELECT Price * Qty AMOUNT
        FROM ITEMS WHERE Code=1004;
    (iii) SELECT DISTINCT Tcode FROM ITEMS;
    (iv) SELECT IName, TName
        FROM ITEMS I, TRADERS T
       WHERE I.Code=T.TCode AND Qty<100;

  • 2)

    Consider the following tables CARDEN and CUSTOMER and answer(a) and (b) parts of this questions:
    TABLE: CARDEN 

    Ccode Car Name Make Color Capacity Charge
    501 A-star Suzuki RED 3 14
    503 Indigo Tata SILVER 3 12
    502 Innova Toyota WHITE 7 15
    509 SX4 Suzuki SILVER 4 14
    510 C-Class Mercedes RED 4 35

    TABLE: CUSTOMER

    CCode CName CCode
    1001 Hamant Sahu 501
    1002 Raj Lal 509
    1003 Feroza Shah 503
    1004 Ketan Dhal 502

    (a) Write SQL commands for the following statements:
    (i) To display the name of all the SILVER colored cars.
    (ii) To display name of CAR,MAKE and sitting Capacity of cars in descending order of their sitting Capacity.
    (iii) To display the higher Charges at which a vehicle can be hired from CARDEN.
    (iv) Todisplay the customer name and the corresponding name of the cars hired by them.
    (b) Give the output of the following SQL queries:
    (i) SELECT COUNT(DISTINCT Make) FROM CARDEN;
    (ii) SELECT MAX(Carges),MIN (Charges) FROM CARDEN;
    (iii) SELECT COUNT(*) Make FROM CARDEN;
    (iv) SELECT CarName FROM CARDEN WHERE Capacity=4;

  • 3)

    Consider the following tables STORE and SUPPLIERS and answer (a) and (b) parts of this questions:
    TABLE: STORE 

    Item No Item Scode Qty Rate LastBuy
    2005 Sharpener Classic 23 60 8 31-JUN-09
    2003 Balls 22 50 25 01-FEB-10
    2002 Gel Pen Premium 21 150 12 24-FEB-10
    2006 Gel Pen Classic 21 250 20 11-MAR-09
    2001 Eraser Small 22 220 6 19-JAN-09
    2004 Eraser Big 22 110 8 02-DEC-09
    2009 Ball Pen 0.5 21 180 18 03-NOV-09

    TABLE: SUPPLIERS 

    Scode Sname
    21 Premimum Stationers
    23 Soft Plastics
    22 Tera Supply

    (a) Write SQL commands for the following statements:
    (i) To display details of all the items in the STORE table in ascending order of LastBuy.
    (ii)To display ItemNo and Item name of those items from STORE table, whose Rate is more than Rs 15.
    (iii) To display the details of those items whose Supplier code(Scode) is 22 or Quantity in store(Qty) is more than 110 from the table STORE.
    (iv) To display minimum rate of items for each Supplier individually as per Scode from the table STORE.
    (b) Give the output of the following SQL queries:
    (i) SELECT COUNT(DISTINCT Scode) FROM STORE;
    (ii) SELECT Rate *Qty FROM STORE WHERE ItemNo=2004;
    (iii) SELECT Item, Sname FROM STORE S,SUPPLIERS P
    WHERE S.Scode=P.Scode AND ItemNo=2006;
    (iv) SELECT MAX(LastBuy) FROM STORE;

  • 4)

    Consider the following tables STUDENT and STREAM. Write SQL commands for the statements(a) to (d) and give outputs for SQL queries (e) to (h).
    TABLE: STUDENT 

    SCODE NAME AGE STRCDE POINTS GRADE
    101 Amit 16 1 6 NULL
    102 Arjun 13 3 4 NULL
    103 Zaheer 14 2 1 NULL
    105 Gagan 15 5 2 NULL
    108 Kumar 13 6 8 NULL
    109 Rajesh 17 5 8 NULL
    110 Naveen 13 3 9 NULL
    113 Ajay 16 2 3 NULL
    115 Kapil 14 3 2 NULL
    120 Gurdeep 15 2 6 NULL

    TABLE: STREAM 

    STRDE STRNAME
    1 SCIENCE+COMP
    2 SCIENCE+BIO
    3 SCIENCE+ECO
    4 COMMERCE+MATHS
    5 COMMERCE+SOCIO
    6 ARTS+MATHS
    7 ARTS+SOCIO

    (a) To display the name of streams in alphabetical order from table STREAM.
    (b) To display the number of students whose POINTS are more than 5.
    (c) To update GRADE to 'A' for all those students, who are getting more than 8 as POINTS.
    (d) ARTS+MATHS stream is no more available. Make necesary change in table STREAM.
    (e) SELECT SUM(POINTS) FROM STUDENT WHERE AGE>14;
    (f) SELECT STRCDE, MAX(POINTS) FROM STUDENT GROUP BY STRCDE HAVING SCODE BETWEEN 105 AND 130;
    (g) SELECT AVG(AGE) FROM STUDENT WHERE SCODE IN(102,105,110,120);
    (h) SELECT COUNT(STRNAME) FROM STREAM WHERE STRNAME LIKE "SCI%";

  • 5)

    Consider the following tables.Write SQL commands for the statements (a) to (d) and give outputs for SQL queries (e) to (h)
    TABLE: SENDER 

    SENDER ID Sender Name Sender Address SenderCity
    ND01 R Jain 2, ABC Appts New Delhi
    MU02 H sinha 12,Newtown Mumbai
    MU15 SJha 27/A,Park Street Mumbai
    ND50 T Prasad 122-k,SDA New Delhi

    TABLE:RECEIPIENT 

    RecID SenderID RecName RecAddress RecCity
    KO05 ND01 R Baipayee 5,Central Avenue Kolkata
    ND08 MU02 S Mahajan 116, A Vihar New Delhi
    MU19 ND01 HSingh 2A,Andheri East Mumbai
    MU32 MU15 P k Swamy B5, C S Terminus Mumbai
    ND48 ND50 S Tripathi 13,B1 D,Mayur Vihar New Delhi

    (a) To display the names of all Sender from Mumbai.
    (b) To display the RecID, Sender Name, Sender Address, Rec Name, Rec Address for every Recipient.
    (c) To display Recipient details in ascending order of RecName.
    (d) To display number of Recipients from each city.
    (e) SELECT DISTINCT SenderCity FROM SENDER;
    (f) SELECT A.SenderName, B.Recname FROM SENDER A, RECIPIENT B
        WHERE A.Sender ID=B.SenderID AND B>RecCity='Mumbai';
    (g) SELECT Recname, RecAddress FROM RECIPIENT
          WHERE RecCity NOT IN('Mumbai','Kolkata');
    (h) SELECT RecID, RecNam FROM RECIPIENT
         WHERE SenderID='MU02' OR SenderID='ND50';

12th CBSE Computer Science - Boolean Algebra Six Mark Question Paper - by Sunil Sharma - Puducherry View & Read

  • 1)

    Reduce the following Boolean expression using K-Map:
    F(A,B,C,D)=(0,1,2,4,5,8,9,10,11)

  • 2)

    Reduce the following Boolean Expression using K-Map:
    F(A,B,C,D)= \(\Sigma \)(0,1,2,4,5,6,8,10)

  • 3)

    Reduce the folowing Boolean expression ussing K-Map
    F(U,V,W,Z)=\(\Sigma \)(0,1,2,3,4,10,11)

  • 4)

    If F(a,b,c,d)=(0,2,4,5,7,8,10,12,13,15), obtain the simplified form using K-Map

  • 5)

    If F(a,b,c,d) = (0,1,3,4,5,7,8,9,11,12,13,15), obtain the simplified form using KMap

12th CBSE Computer Science - Data Structure and Pointers Four Mark Question Paper - by Sunil Sharma - Puducherry View & Read

  • 1)

    Write a function QINSERT() in C++ to perform insert operation on a linked queue, which contains client no and Client name.Consider the following definition of NODE in the code of QINSERT():
    struct NODE
    {
         long int Cno;              //Client number
         char Cname[20];        //Client name
         NODE *Next;
    };

  • 2)

    Write a function in C++ to perform insert operation in a dynamic queue containing DVD's information (represented with the help of an array of structureDVD).
    struct DVD
    {
      long No;
      char title[20];
      DVD *Link;
    };

  • 3)

    Write a function QUEINS() in C++to insert an element in a dynamically allocated queue containing nodes of the following given structure.
    struct Node
    {
       int Pid;                      //Product id
       char Pname[20];        //Product name
       Node *Next;
    };

  • 4)

    Write a function in C++ to insert an element in a dynamically allocated queue,where each node contains a Name(char) as data.Assume the following definition of THENODE for the same:
    structTHENODE
    {
      char Name[20];
      THENODE *Link;
    };

  • 5)

    Write function PUSHBOOK() in C++ to perform insert operation on adynamic stack,which contains Book_no and Book_Titile.Consider the following defination of NODE,while writing your C++code.
    struct NODE
    {
      char Book_No;
      char Book_Title[20];
      NODE *Next;
    };

CBSE 12th Standard Computer Science - Data File Handling in C++ Four Mark Question Paper - by Sunil Sharma - Puducherry View & Read

  • 1)

    Write a function COUT_TO() in C++ to cout the presence of aworld 'to' in text file NOTES.TXT is as it is very important to know that smoking is injurious to health,let us take initiative to stop it.The function COUT_TO()will display the following message cout of-to=in file:3

  • 2)

    Write a function EUCout() in C++,which should reads each character of a a text file.IMP.TXT,should count and display the occurrence of
    alphabets E and U (including small case e and u too). e.g. if the file contain is as follows: Update information is simplified by official websites.The EUCount() function should display the output as:
                               E:4
                               U:1

  • 3)

    Write the function in C++ to read the content of a text file PLACES.TXT and display all those lines on screen,which are either starting with'P' or starting with'S'

  • 4)

    Assuming the class GAMES as declard below, write a function in C++ to read the objects of GAMES from binary file GAMES.DAT and
    display those details of those GAMES, which are meant for children of Age Range"8 to 13"
    class GAMES
    {
        int Gamecode;
        char GameName[10];
        char *AgeRange;
        public:
           void Enter()
           {
               cin>>GameCode;
               gets(GameName);
               gets(AgeRange);
           }
           void Display()
           {
             cout<cout<        }
           char *AgeR() {return AgeRange;}
    };

  • 5)

    Write a function in C++ to search for the details(phone no and Calls) of those phons, which have more than 1000 calls from a binary file phons.dat. Assuming that this binary file contains records? objects of class phone, which is defined below.
    class phone
    {
      char phoneno[10];
      int calls;
      public:
         void get(){gets(phoneno);
         cin>>calls;
         void billing(){cout<<int getCalls(){return calls;}
    };

12th CBSE Computer Science - Object Oriented Programming in C++ Five Mark Question Paper - by Sunil Sharma - Puducherry View & Read

  • 1)

    To show the working of function returning object.

  • 2)

    To show the use of static function.

  • 3)

     Find the ouptput of the following :
    #include< iostream.h >
    #include< conio.h >
    #include< stdio.h >
    #include< string.h >
    #include< ctupe.h >
    void main( )
    {
    char *Name= “IntRAneT”;
    for(int x =0; x=0;x < strlen(Name);x++)
    {
    if(islower(Name[x]))
    Name[x]=toupper(Name[x]);
    {
    if(islower(Name[x]))
    Name[x]=toupper (Name[x]);
    else
    if(isupper(Name[x]))
    if(x%2==0)
    Name[x]=tolower(Name[x]
    else
    ame[x]=Name[x-1];
    }
    puts(Name)
    }
     

  • 4)

    Write the output of the following C++ code.Also, write the name of feature of object-oriented programming used in the following program jointly illustrated by the functions [I] to [IV].

  • 5)

    Consider the following C++ code and answer the questions from (i) to (iv)
    class Student
    {
        int Class, Rno;
        char Section;
        protected:
           char SName[20];
       public:
           Student();
           void Stentry();
           void Stdisplay();
    };
    class Score : private Student
    {
        float Marks[5];
        protected:
           char Grade[5];
        public:
           Score();
           void Sentry();
           void Sdisplay();
    };
    class Report : public Score
    {
        float Total, Avg;
        public:
            char OverallGrade, Remarks[20];
            Report();
            void REaluate();
            void RPrint();

    };
    (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 Report.
    (iii) Write the names of those member functions, which can be directly accessed  from the objects of class Report.
    (iv) Write the names of those data members, which can be directly accessd from the Sentry() function of class Score.

12th CBSE Computer Science - Review of C++ Five Mark Question Paper - by Sunil Sharma - Puducherry View & Read

  • 1)

    To check the number is divisible by 6 or not using nested if statement

  • 2)

    To show the use of continue statement.

  • 3)

    Rewrite the following program after removing the syntactical error(s), (if any). Underline each correction.
    #include<iostream.h>
    const int Multiple 3;
    void main()
    {
    value = 15;
    for( int Counter=1; Counter=<5; Counter++, value-=2)
    if(value%Multiple==0)
           cout<<Value*Multiple;        
           cout<<endl;
    else 
           cout<<Value+Multiple<<endl;
    }

  • 4)

    Write the following program execute successfully? If not, state the reason(s).
    #include<stdio.h>
    void main()
    {
        int x, sum=0;
        cin<<n;
        for( X=1, x<100, x+=2)
         if x%2==0
           sum +=x;
    cout>>"sum=">>sum;
    }

  • 5)

    Write a program to print the following output after inputting the value of n. The user should be prompted again for the value of n, if the inputted value does not lie between 1 to 6 do the inclusive.

                                     1
                              1     2     3
                        1     2    3     4    5
                  1    2     3    4     5     6    7
                  -    -     -      -      -      -     -
         1       2   -     -     -       -     -      -   (2n-1)

12th CBSE Computer Science Review of C++ Model Question Paper 2 - by Ekta Bhalla - Kottayam View & Read

  • 1)

    Generally there are four data types, each of which can be signed or unsigned.Write names of all four data types.

  • 2)

    If v is an identifier of int type and is holding value 255. Is the following statement correct?
    char code = v;

  • 3)

    Do you see any similarity between a typedef name and a reference name? If yes, what is it?

  • 4)

    Which value of x will be printed in following case and why?
    int x=9;
    void main()
    {
      int x = 10;
      cout<<x;
    }

  • 5)

    In the following program:
    i) How many times will the while loop run?
    ii) What would be the last value of A displaced out?
    #include<iostream.h>
    void main()
    {
          int A=10;
          while(++A<15)
          { 
              cout<<A++;
         }
    }

12th Standard CBSE Computer Science Unit 7 Communication Technologies Model Question Paper - by Ekta Bhalla - Kottayam View & Read

  • 1)

    Which of the network (out of LAN, PAN and MAN) is formed, When you connect two mobiles using Bluetooth to transfer a picture file?

  • 2)

    Write one advantage of bus topology of the network. Also, illustrate how four computers can be connected with each other using star topology of network?

  • 3)

    Expand the following abbreviations:

    (i) HTTP                     (ii) ARPANET 

  • 4)

    What is a protocol? Which is used to search information from internet using an internet. 

  • 5)

    What is the advantage of using SWITCH over HUB?

12th Standard CBSE Computer Science Unit 6 Boolean Algebra Sample Question Paper - by Ekta Bhalla - Kottayam View & Read

  • 1)

    Write the Product of Sum(POS) form of the function F(X, Y, Z) for the following truth table representation of F:

    X Y Z F
    0 0 0 1
    0 0 1 0
    0 1 0 0
    0 1 1 1
    1 0 0 0
    1 0 1 0
    1 1 0 1
    1 1 1 1
  • 2)

    Write the dual of the boolean expression \((A+0).(A.1.\bar { A } )\)

  • 3)

    Find the complement of the following boolean function \({ F }_{ 1 }=A.B+\bar { C } .\bar { D } \) :

  • 4)

    Why are NAND and NOR gates called Universal gates?

  • 5)

    Express \(P+\bar { Q } .R\) in canonical SOP form

12th CBSE Computer Science Unit 5 Database and SQL Important Question Paper - by Ekta Bhalla - Kottayam View & Read

  • 1)

    What are DDL and DML?

  • 2)

    Differentiate between SQL commands DROP TABLE and DROP VIEW.

  • 3)

    Write a query on the SALESPEOPLE table, whose output will exclude all salespeople with a rating >=100, unless they are located in Delhi.

  • 4)

    What is the difference between degree and cardinality of a table? What is the degree and cardinality of the following table?

    Eno Name salary
    101 John Fedrick 45000
    102 Raya Mazumdar 50600

    Differentiate between the terms degree and cardinality in context of RDBMS. 

  • 5)

    Explain the concept of candidate keys with the help of an appropriate example.

12th CBSE Computer Science Unit 4 Data Structure and Pointers Important Question Paper - by Ekta Bhalla - Kottayam View & Read

  • 1)

    An array circular queue[10] of integers exixt,where currently
    Rear=0, Front=1
    Answer the following questions based on the above given data:
    (i) How many values arte there in queue?
    (ii) If five valuesare deleted,whatwould be the new value of Front?

  • 2)

    How wil you know that a linear queue is full?

  • 3)

    Suppose a circular queue maintained by an array Q with 12 memory locations and Front and Rear are the two pointers.
    Find the number of elements in Q when:
    (i) Front=4, Rear=8
    (ii) Front=10, Rear=3
    (iii) Front=5, Rear=6
    and then two elements are deleted.

  • 4)

    What are the drawbacks of linear queue?

  • 5)

    Write code for a function void Convert(int T[], int Num) in c++, which reposition all the elements of the array by shifting the element to the last position.

    0 1 2 3 4
    22 25 70 32 12

    The changed content will be:

    0 1 2 3 4
    25 70 32 12 22

12th Standard CBSE Computer Science Unit 3 Data File Handling in C++ Important Question Paper - by Ekta Bhalla - Kottayam View & Read

  • 1)

    Write a function COUT_TO() in C++ to cout the presence of aworld 'to' in text file NOTES.TXT is as it is very important to know that smoking is injurious to health,let us take initiative to stop it.The function COUT_TO()will display the following message cout of-to=in file:3

  • 2)

    Write a function EUCout() in C++,which should reads each character of a a text file.IMP.TXT,should count and display the occurrence of
    alphabets E and U (including small case e and u too). e.g. if the file contain is as follows: Update information is simplified by official websites.The EUCount() function should display the output as:
                               E:4
                               U:1

  • 3)

    Write a function in C++ to search for the details(phone no and Calls) of those phons, which have more than 1000 calls from a binary file phons.dat. Assuming that this binary file contains records? objects of class phone, which is defined below.
    class phone
    {
      char phoneno[10];
      int calls;
      public:
         void get(){gets(phoneno);
         cin>>calls;
         void billing(){cout<<int getCalls(){return calls;}
    };

  • 4)

    Write a function in C++ to count the words "to" and "the" present in a text file POEM.TXT.(Note that the words "to" and "the" are complete words.)

  • 5)

    Write a function to count the member of words prsent in a text file named PAPER.TXT.Assume that each word is separated by a single blank/space in the beginning and end of the file.

12th CBSE Computer Science Unit 2 Object Oriented Programming in C++ Important Question Paper - by Ekta Bhalla - Kottayam View & Read

  • 1)

    How are the object's behaviour and object's characteristics represented in OOP?

  • 2)

    Why function overloading is used?

  • 3)

    How are abstraction and encapulation interrelated?

  • 4)

    Inheritance allows code reusability in OOp.Explain how?

  • 5)

    Observe the program segment carefully and answer the question that follows: class member
    {
    int member_no;
    char member_name[20];
    public:
    void enterDetail( );
    void showDetail( );
    int getMember_no( ){ return member_no;}
    };
    void update(member NEW )
    {
    fstream File;
    File.open( “member.dat”, ios::binary|ios::in|ios::out) ;
    member i;
    while(File .read((char*) & i , sizeof (i)))
    {
    if(NEW . getMember_no( ) = = i . getMember_no( ))
    {
    ___________//missing statement
    File.write((char*) &NEW , sizeof (NEW));
    }
    }
    File.close() ;
    }
    If the function update( ) is supposed to modify the member_name field of a record in the file “ member.dat” with the values of member NEW passed as argument, write the appropriate statement for the missing statement using seekp( ) or seekg( ), whichever is needed, in the above code that would write the modified record at its proper place.

CBSE 12th Computer Science Unit 1 Review Of C++ Important Question Paper - by Ekta Bhalla - Kottayam View & Read

  • 1)

    Generally there are four data types, each of which can be signed or unsigned.Write names of all four data types.

  • 2)

    How 'I' operator is different from '%' operator?

  • 3)

    What is wrong with the following C++ statement?
    long float y;

  • 4)

    Differentiate between an identifier and keywords.

  • 5)

    Show two different ways to declare as integer variable named intname and set its value to 15.