Vous êtes sur la page 1sur 7

SAMPLE PAPER-8

COMPUTER SCIENCE (Theory)


Class-XII
Time Allowed: 3hours Maximum Marks: 70

Ques.1.(a) What is the difference const and #define. Also give suitable
code to illustrate both. [2]
(b) Write names of the header files, which is/are essentially required
to run/execute the following C++ code: [1]
void main ()
{ char C, String[] = “Excellence Overload”;
for (int I=0; String[I]! = ‘\0’; I++)
if (String [I] = =’ ‘ ) cout<<endl;
else
{ C=toupper(String[I]); cout<<C; }
}
(c) Rewrite the following program after removing the syntactical errors
(if any). Underline each correction. [2]
#include [iostream.h]
typedef char Text(80);
main()
{ Text T = “Indian”;
int Count= strlen(T);
cout<<T<<”has‟<<Count<<”characters‟<<endl;
}
(d) Find the output of the following program: [3]
# include <iostream.h>
void ChangeArray (int Number, int ARR[], int Size)
{ for (int L=0; L<Size; L++)
if (L<Number)
ARR[L] + = L;
else
ARR[L] * = L;
}
void Show(int ARR [], int Size)
{ for (int L=0; L<Size; L++)
(L%2!=0) ? cout<<ARR[L] <<“#” : cout<<ARR[L] <<endl;
}
void main ( )
{ int Array[] = {3,2,4,1,6,5};
ChangeArray(4, Array, 5); Show(Array,6);
}
(e) Find the output of the following program: [2]
# include <iostream.h>
void main()
{ int Track[]={60,30,20,10,50},*Striker ;
Striker = Track ; Track[1] + =10 ;
cout<<“Striker”<<*Striker<<endl ;
*Striker - =10 ;
Striker++;
cout<<“Next @”<<*Striker <<endl ;
Striker+=2 ;
cout<<“last @”<<++*Striker<<endl ;
cout<<“Reset To” <<Track[0]<<endl ; }
(f) Go through the C++ code given below, and find out the possible
output/ outputs from the suggested options (i) to (iv). Also write the
least value and highest value, which can be assigned to variable G. [2]
# include <iostream.h>
#include <stdlib.h>
void main ( )
{ randomize ();
int G, High=4 ;
G=random(High) +50;
for (int C=G;C<=55;C++)
cout<<C<<“#”;
}
(i) 50#51#52#53#54#55#
(ii) 52#53#54#55#
(iii) 53#54#
(iv) 51#52#53#54#55

Q.2(a) What is the difference private and public access specifiers in a


class ? Give an example to illustrate the same. [2]

(b)Answer the questions (i) and (ii) after going through the following
class declarations: [2]
class teacher
{ char subject[20]; int salary;
public:
teacher( ) //Function 1
{ strcpy(subject, “Computer”);
salary = 10000;
}
teacher(char p[]) //Function 2
{ strcpy(subject,p);
salary = 1000;
}
teacher (int m) //Function 3
{ strcpy(subject,”maths”);
salary = m;
}
teacher( teacher &th ) //Function 4
{ strcpy(subject, th.subject);
salary = th.salary;
}
};
(i) Which feature of OOP is demonstrated by Function 1, Function 2,
Function 3 and Function 4 together?
(ii) Write statements in C++ to execute Function 2 function4.
(c) Define a class Library in C++ with the following specification:
Private Members: [4]
B_code of type integer
Description of type string
No_of_pages of type integer
Cost_per_page of type integer
Price of type integer
A member function calculate() to calculate and return the
price as (No_of_pages* Cost_per_page)
Public Members:
(i) A function Enter() to allow user to enter values for B_code,
Description, No_of_pages, Cost_per_page & call function
calculate() to calculate the price of the book.
(ii) A function Disp() to allow user to view the contents of all the
data members.
d) Answer the questions (i) to (iv) based on the following code: [4]
class Dolls
{ char Dcode[20];
protected:
float price;
void clcprice();
public:
Dolls();
void read(); void show();
};
class softdolls : public Dolls
{ char sdname[20]; float weight;
public:
softdolls();
void sdinput(); void sdshow();
};
class electronicdolls : public Dolls
{ char Edname[20]; char Batteries[30];
public:
electronicdolls( );
void Edinput( ); void Edshow( );
};
(i) Which type of inheritance is shown in the above example?
(ii) Write the size in bytes of an object of class electronicdolls.
(iii) Name all data members accessible from member functions of class
softdolls.
(iv) Name all member functions accessible by an object of class
electronicdolls.

Q.3.(a) Write a function in C++, which accepts an integer array and its
size as arguments and deletes an element from the array. [3]

(b) An array V[40][10] is stored in the memory along the column with
each element occupying 4 bytes. Find the address of the location V[3]
[6] if the location V[30][10] is stored at address 9000. [3]
(c) Write a function in C++ to insert an element into a statically
allocated Queue containing data of following type: [4]
struct THENODE
{ int sno;
char Name[25];
};
(d) Write a function in C++ to print the product of elements of the
lower triangle of a 2D integer array passed as argument to the function.
(Assuming array as a square matrix). [2]
(e) Evaluate the following postfix notation of expression(Show status of
stack after execution of each operation): 5, 20, 15,-,*, 25, 2,*, + [2]

Q.4.a) Observe the program segment given below carefully, and answer the
question that follows: [1]
class student
{ long sid; // student’s id
char Name[30]; //student’s name
float score; //student’s score
public:
void Enroll( ); void Disp ( );
void MarkScore(); // function to change score
long R_Sid () { return Sid; }
};
void Scoreupdate ( long id )
{ fstream File;
File.open(“STUD.DAT”, ios:: binary | ios :: in | ios :: out);
student S; int Record = 0 ,found = 0;
while (!found && File.read((char *)&S,sizeof(S)))
{if (id == S.R_Sid())
{ cout<<”Enter new score “; S.MarkScore();
-------------------------------------------- //statement 1
------------------------------------------- //statement 2
found =1;
} Record ++;
if(found ==1) cout << “\nrecord update”;
File.close( );}
}
Write statement 1 to position the file Pointer at the beginning of the
record for which the student’s Id matches with the argument passed, and
statement 2 to write the updated record at the position.
b) A text file “PARA.TXT” is available to you which contains a paragraph.
Write a function OCCUR() that searches for a particular character and
displays number of times the character is present in the whole file. [2]
Example:
If content of the file “PARA.TXT” is as follows:
This Is The ProgrAm to find out the frequency Of a Character
The function OCCUR() will display the following output:
Give the character : a
Number of times : 4
(Both upper & lowercase characters are considered for the output)
c)Given a class TRAIN as follows: [3]
class TRAIN
{ long Train_No; int Distance;
char Start_Place[30],End_Place[30];
public:
char *retStart_Place() { return Start_Place; }
void Input()
{ cin>>Train_No>>Distance; gets(Start_Place); gets(End_Place); }
void Output( )
{ cout<<Train_No<<Start_Place<<End_Place<<Distance<<endl; }
};
Write functions for the following:
(i) To write an object of TRAIN type into a binary file
“TRAIN.DAT”
(ii)To read the data from file “TRAIN.DAT” and display
the details of trains starting from “Mumbai”.
Q.5.(a) What do you understand by the following terms in RDBMS.
i- Degree ii- View. [2]
(b) Consider the following tables, write SQL commands for the statements
(i)-(iv) and give outputs for SQL queries (v)-(viii) [6]
Table : CLOTHES
CCODE DESCRIPTION PRICE FCODE READYDATE
10023 PENCIL SKIRT 1150 F03 19–DEC–08
10001 FORMAL SHIRT 1250 F01 12–JAN–08
10012 Table
INFORMAL : FABRIC
SHIRT 1550 F02 06–JUN–08
10024 BABY FCODE TOPTYPE 750 F03 07–APR–07
F04 POLYSTER
10090 TULIP SKIRT 850 F02 31–MAR–07
F02 COTTON
10019 EVENING GOWN 850 F03 06–JUN–08
F03 SILK
10009 INFORMAL PANT 1500 F02 20–OCT–08
F01 TERELENE
10007 FORMAL PANT 1350 F01 09–MAR–08
10020 FROCK SKIRT 850 F04 09–SEP–07
10089 SLACKS SKIRT 750 F03 20–OCT–08
i)Display CCODE & DESCRIPTION of each dress in descending order of CCODE
ii) To display the details of all the CLOTHES, which have READYDATE in
between 08–DEC–07 and 16–JUN–08 (inclusive of both the dates).
iii) To display the average PRICE of all the CLOTHES, which are made up
of FABRIC with FCODE as F03.
iv) To display FABRIC wise highest & lowest price of CLOTHES.(Display
FCODE of each CLOTH along with highest and lowest price )
v) SELECT SUM (PRICE) FROM CLOTHES WHERE FCODE= ‘F01’;
vi) SELECT DESCRIPTION, TYPE FROM CLOTHES, FABRIC WHERE CLOTHES.FCODE=
FABRIC.FCODE AND CLOTHES.PRICE >= 1260;
vii) SELECT MAX (FCODE) FROM FABRIC;
viii) SELECT COUNT (DISTINCT PRICE) FROM CLOTHES;

Q.6.(a) Using the method of algebra, prove the Boolean relation given
below: XY + X’Z + YZ = XY + X’Z [2]
(b) Write Canonical POS expression from truth table given below: [1]
A B C F
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 0

(c) Simplify the Boolean expression given below using the method of
Karnaugh Map: F (P,Q,R,S) = π (0, 1, 3, 5, 6, 7, 10, 14 , 15) [3]
(c) Write the output of the circuit diagram given below: [2]

Q.7)(a)Differentiate between client side and server side scripting? [1]


(b) Write the full formS of following: (i) PHP (ii) SMTP [1]
(c) What is 3G technology. [1]
(d) Define Spam and Blog. [1]
(e) INDIAN PUBLIC SCHOOL in Darjeeling is setting up the network among
its different wings. There are 4 wings named as SENIORS(S), JUNIORS(J),
ADMIN(A) and HOSTEL(H) as shown in the diagram given below: [4]

Number of computers:

(i) Suggest the most suitable cable layout of connections among


the wings and topology.
(ii) The school wants to provide and share internet access in and
among each of the buildings. How can this be achieved?
(iii) Suggest the placement of the following devices with
justification: (a) Repeater (b) Server
(iv) The school is planning to connect its head office in the
closest big city, which is more than 350 km from the school
campus. Suggest a suitable transmission medium for it.
Justify your answer.

(f) Write the difference between “Open Source Software” and “Proprietary
Software”. [1]

(g) Give names of 2 client side scripting languages. [1]

Vous aimerez peut-être aussi