Computer Science


Sample Paper – 2011
Class – XII
 Subject -
Computer Science (083)
Time: 3 hrs                                                                                                                                                                                                          MM: 70
Note:
v  All questions are compulsory.
v  Programming Language C++.

1.       (a)          What is difference between type casting and automatic type conversion? Explain with suitable example
in C++.                                                                                                                                                                                  2
(b)          Name the header files for which the following function belongs:                                                                               1
                                (i)            setw ( )                                 (ii)           malloc( )
(c)           Rewrite the following program after removing all syntactical error(s), if any. Underline each correction:
                #include<iostream.h>                                                                                                                                                   2
                struct Display
                {
                int ROW, COL;
                }
                void ShowPoint(Display D)
                {
                                cout<< D.ROW << D.COL << endl;
                }
                void main( )
                (
                                Display Disp1 = ( 10, 20 );
                                Disp1.Showpoint( );
                                Display Disp2 = Disp1;
                                ROW + = 15;
                                Showpoint.Disp2;
                }
(d)          Give the output of the following program:                                                                                                           2
                #include<iostream.h>
                void main( )
                {
                                int *ptrArray[10];
                                int marks[ ] = {75, 68, 90, 34, 0, 10, 90, 65};
                                for ( int i = 0 ; marks[i] != 0 ; i++)
                                {
                                                ptrArray[i] = &marks[i];
                                                *(ptrArray[i]) += 5;
                                ]
                                int index = 0;
                                while(index < i)
                                {
                                                int k = *(ptrArray[index];
                                                if (k > 60)
                                                                cout<< k <<’,’;
                                                index++;
                                }
                }

(e)          Give the output of the following program:                                                                                                           3
                #include<iostream.h>
                void main( )
                {
                                char *DATA = “ a HexaDecimal”
                                for( int ctr = 0 ; ctr < strlen(DATA) ; ctr ++)
                                                if( islower (DATA[ctr] ))
                                                                DATA[ctr] = toupper (DATA[ctr]);
                                else
                                                if (isupper (DATA[ctr] ))
                                                                if (ctr % 2 != 0)
                                                                                DATA[ctr] = tolower ( DATA [ ctr 1 ];
                                                                                else
                                                                                                DATA [ctr ] 2;
                                cout<< DATA ;
                }

(f)           Study the following program and select the possible output from it:                                                        2
                #include<iostream.h>
                #include<stdlib.h>
                const int BIG = 3 ;
                void main( )
                {
                                randomize( );
                                int Digit ;
                                Digit = 90 + random (BIG );
                                for (int K =  DIGIT ; K >= 90 ; K ‒ ‒)
                                                cout<< K << “$”;
                }

(i)                  93$93$92$91$90$
(ii)                91$90$
(iii)               90$91$92$
(iv)              90$92$                                 
                               
2.       (a)          Differentiate between Function Overloading and Default Arguments with suitable example.      2
(b)          Answer the questions (i) to (ii) after going through the following class:                                                   2
                class Teacher
                {
                                char Subject[30];
                                int Salary;
                public:
                                Teacher( )                                                                                           // Function 1
                                {
                                                strcpy (Subject, “ Economics”);
                                                Salary = 15000;
                                }
                                Teacher ( char T[ ])                                                                          // Function 2
                                {
                                                strcpy (Subject, T);
                                                Salary = 15000;
                                }
                                Teacher ( int S)                                                                                  // Function 3
                                {
                                                strcpy (Subject, “Economics);
                                                Salary = S;
                                }
                                Teacher (chat T[ ], int S)                                                                                // Function 4
                                {
                                                strcpy (Subject, T);
                                                Salary = S;
                                }
                }
(i)                  Which feature of object oriented programming is demonstrated using Function1, Function2, Function3 and Function4?
(ii)                Write statement in C++ that would call Function 2 and Function 4 of class Teacher.
(c)           Define a class named STREAM in C++ with following description:                                                                               4
                Private Members:
·         AD_NO                 Integer (Ranges 10 – 2000)
·         NAME                   Array of Character
·         Percentage         Float
·         FEES                       Float
Public Members:
·         A function Read_Data( ) to input the values of AD_NO, NAME and Percentage.
·         A function Select_Stud ( ) to choose students for different streams depending upon their percentage and assign the fees they have to deposit as given below:
Percentage
Stream
Fees
Percentage >= 90
Computer
20000
Percentage <90 but >=80
Biology
18000
Percentage <80 but >= 70
Commerce
14000

·         A function Disp_Data( ) to display the value of all the data members.
(d)          Answer the questions (i) to (iv) after going through the following class:                                                 4
                class Person
                {
                                                char Name[30];
                                protected:
                                                char Address[20];
                                public:
                                                Person( );
                                                void read_Person ();
                                                void disp_Person( );
                };
                class Employee : protected Person
                {
                                                int ENo;
                                protected:
                                                float Salary;
                                public:
                                                Employee( );
                                                void read_Employee( );
                                                void disp_Employee( );
                };
                class Student : private Person
                {
                                                int RollNo;
                                                float Marks;
                                public:
                                                Student( );
                                                void read_Sudent( );
                                                void disp_Student ();
                };
(i)                  Which type of Inheritance is shown in the above example?
(ii)                Mention the name of ALL members that are accessible by the member function of class Employee.
(iii)               Mention the name of member functions that are accessible by the object of class Student.
(iv)              How many bytes will be required by an object of class Employee?

3.       (a)          Write a function in C++ which accepts an integer array and its size as argument and exchange the value
of all negative elements with their positive equivalent.                                                                                  3
Example:
                If an array contains:
                                ‒2, 4, ‒1, 6, ‒7, 9, ‒23, 10
                The function should rearrange the array as:
                                2, 4, 1, 6, 7, 9, 23, 10
(b)          An array B [30][10] is stored in the memory along the row with each element occupying 4 bytes of storage. Find the base address an address of the element B [10][4], if the location B [3][3] is stored at the address 1500.                                                                                                                                                     3
(c)           Consider the following portion of a program, which implements a linked stack for BOOKS. Write the user defined function PUSH( ) to insert a new node in the stack with required information:
                struct BOOK                                                                                                                                                                       4
                {
                                int BNO;
                                char TITLE[20];
                                char Author[30];
                                BOOK *Next;
                };
                class Stack
                {
                                BOOK *top;
                public:
                                Stack( )
                                {
                                                top = NULL;
                                }
                                void PUSH( );
                                void POP( );
                };

(d)          Write a user defined function to print the product of each row of a two dimensional array passed as the argument of the function:                                                                                                                                           2
                Example:             If the two dimensional array contains:
                                               
2
5
4
7
3
6
2
2
4
2
1
3
               
Then the output should appear as:
                                Product of Row 1 = 280
                                Product of Row 2 = 72
                                Product of Row 3 = 24
(e)          Evaluate the following postfix notation expression and show status of stack after execution of each operation:                                                                                                                                                                           2
                                                A * ( B + D ) / E ‒ F ‒ (G + H / K) ]

4.       (a)          Observe the following program segment given below carefully and fill the blanks marked as Statement 1
and Statement 2 using seekg( ) and tellg( ) functions for performing the required task:                  1
                #include<fstream.h>
class Flight
{
                                int FNo,
                                char FName[20];
public:
                                // Function1 to count total number of records.
                                int CountRec( );
};
int Flight :: CountRec( )
{
                                Flight Obj;
fstream File;
                                File.open(“Flight.Dat”, ios::in | ios::binary);
                                ……………………………………………………………..// Statement 1
                                int bytes =……………………………………………..// Statement 2
                                int count = bytes / sizeof(Obj);
                                File.close( );
return count;
 }

(b)          Write a function in C++ to count the word “are” as an independent word present in a text file SEARCH.TXT.                                                                                                                                                                                2
                Example:
                                If the Line contains:
                                                “Those are wild animals. They are carnivores.”
                                Then the output should be:
                                                The Word “are” = 2
(c)           Write a function in C++ to add new object at the bottom of the binary file “PRODUCT.Dat” whose product price is more than Rs 200. Assuming that binary file is containing the objects of the following class:                                                                                                                                                                                           3
                class PRODUCT
                {
                                int PRODUCT_no;
                                char PRODUCT_name[20];
                                float PRODUCT_price;
                public:
                                void enter( ) { cin>> PRODUCT_no ; gets(PRODUCT_name) ; cin >> PRODUCT_price;}
                                void display( ) { cout<< PRODUCT_no ; cout<<PRODUCT_name ;cout<< PRODUCT_price; }
                                int ret_Price( )
                                {
                                                return PRODUCT_price;
                                }
                };            


5.       (a)          What is a relation? Define the relational data model.                                                                                       2
(b)          Consider the following table CLUB and MEMBER. Write the SQL commands for the statements (i) to (iv) and output from (v) to (viii).                                                                                                                                                6
                Table: CLUB
               
GCode
GameName
Number
Fees
StrtingDate
101
Carom Board
2
5000
23-Jan-2004
102
Badminton
2
12000
12-Dec-2003
103
Table Tennis
4
8000
14-Feb-2004
105
Chess
2
9000
01-Jan-2004
108
Lawn Tennis
4
25000
19-Mar-2004

                Table: MEMBER
               
PCode
Name
GCode
1
Nabi Ahmad
101
2
Ravi Sahai
108
3
Jasvinder
101
4
Robert
103

(i)                  To display the name of all the games with their GCodes.
(ii)                To display all information of those games which are having fees more than 10000.
(iii)               To display the information of CLUB table in descending order of StartDate.
(iv)              To display Name and Number of All the members from the Table CLUB and MEMBER.
Give the Output:
(v)                SELECT COUNT(DISTINCT Number) FROM CLUB;
(vi)              SELECT MAX(StartDate), MIN(StartDate) FROM CLUB;
(vii)             SELECT SUM(Fees) FROM CLUB
WHRE GameName LIKE (“C%”);
(viii)           SELECT DISTINCT GCode FROM MEMBER.

6.       (a)          Prove Algebraically:                                                                                                                                                        2
                                    
(b)          Draw a logic circuit diagram for the following Boolean Expression:                                                             2
                               
(c)           Convert the following Boolean expression into its equivalent Canonical Product of Sum form:     1
                               
(d)          Reduce the following Boolean Expression using K-map:                                                                                 3
                                F (X, Y, Z, W) = )

7.       (a)          Define the term Bandwidth. Give any one unit of Bandwidth.                                                                     1
(b)          Give the full form of the following:                                                                                                                          1
                (i) MAC                                 (ii) NFS
(c)           Differentiate between Bridge and Router.                                                                                                           1
(d)          Write the name of two types of viruses.                                                                                                                               1
(e)          Ease and West Public Ltd has decided to network all its offices spread in five building as shown below:
               

                                                                                                                Building 2


                                      Building 1                                                                                                                              Building 3





                                                                                    Building 5
                                                                                                                                                                                Building 4


                The distance between various buildings is as follows:

                                Building 1 to Building 2                                   20Mts
                                Building 3 to Building 5                                   70Mts
                                Building 2 to Building 3                                   50Mts
                                Building 1 to Building 5                                   65Mts
Building 3 to Building 4                                   120Mts
Building 2 to Building 5                                   50Mts
Building 4 to Building 5                                   30Mts
                                Number of Computers in each building:
                                                Building 1                             40
                                                Building 2                             45
                                                Building 3                             110
                                                Building 4                             60                          
                                Building 5                             70







(i)                  Suggest a cable layout for connecting all the buildings together.                                                                1
(ii)                Suggest the most suitable building to install the server of the organization with a suitable
reason.                                                                                                                                                                 1
(iii)               Building 3 is used for many critical operations. It is tries that PC gets maximum possible bandwidth. Which network device is/should be used for this?                                                            1


(iv)              The organization also has another office in same city but at a distant location about25-30 Km away. How can link be established with building 1. (suggest the transmission media).   1
               
(f)           What is FSF? Who was the founder of FSF?                                                                                                          1
(g)          Define the term Spam.                                                                                                                                                  1

***********


Anjani Kumar Dubey (MCA, M.Sc [CS])
HOD, Computer Science
Dr. Rizvi Learners’ Academy, Jaunpur
È+91 9794879476
anjanidubey12@yahoo.in