Guess Paper – 2008
Class – XII
Subject – Computer Science
Time allowed : 3 Hours Maximum Marks : 70
Note (i) All questions are compulsory.
(ii) Programming Language : C++
- (a) Differentiate between a global variable and a local variable. Also give suitable example in
C++. 2
(b) Name the Header file(s) that shall be needed for successful compilation of the following
C++ code? 2
void main()
{
char st[20];
gets(st);
if(isaplha(st[0])
cout<<"Starts with alphabet";
else
cout<<strlen(st);
}
(c) Rewrite the following program after removing syntactical error(s) if any. Underline each
correction. 2
#include<iostream.h>
#define SIZE =10
void main()
{
int a[SIZE]={10,20,30,40,50};
float x=2;
SIZE=5;
for(int i=0;i<SIZE;i++)
cout<<a[i]%x;
}
(d) Find the output of the following program : 3+2=5
i) #include<iostream.h>
#include<string.h>
struct Student
{
int rno;
char name[20];
};
void main()
{
student a[2]={1,"Amit",}{2,"Sumit"}};
for(int i=0;i<2;i++)
{
cout<<"\n Rno"<<a[i].rno;
cout<<"\n Name ";
for(int j=0;j<strlen(a[i].name);j++)
cout<<a[i].name[i]<<" ";
}
}
- #include<iostream.h>
int a=10;
void main()
{
void demo(int &,int,int*);
int a=20,b=5;
demo(::a,a,&b);
cout<<::a<<a<<b<<endl;
}
void demo(int &x,int y,int *z)
{
a+=x;
y*=a;
*z=a+y;
cout<<x<<y<<*z<<endl;
}
(e) In the following C++ program , what will the maximum and minimum value of r generated with the
help of random function. 2
#include<iostream.h>
#include<stdlib.h>
void main()
{
int r;
randomize();
r=random(20)+random(2);
cout<<r;
}
- Answer the questions(i) and (ii) after going through the following class : 2
class Exam
{
int year;
public :
Exam(int y) { year=y; }
Exam(Exam &t);
}
- Create an object, such that it invokes constructor 1.
- Write complete definition for constructor 2.
2. Define a class Competition in C++ with the following descriptions: 4
Data Members
Event_no integer
Description char(30)
Score integer
qualified char
Member functions
A constructor to assign initial values Event_No number as 101,Description as "State level" Score is
50 , qualified 'N'.
Input() To take the input for event_no,description and score.
Award(int) To award qualified as 'Y', if score is more than the cutoffscore passed as
argument to the function else 'N'.
Show() To display all the details.
3. Answer the questions (i) to (iv) based on the following code : 1+1+1+1=4
class Employee
{
int id;
protected :
char name[20];
char doj[20];
public :
Employee();
~Employee();
void get();
void show();
};
class Daily_wager : protected Employee
{
int wphour;
protected :
int nofhworked;
public :
void getd();
void showd();
};
class Payment : private Daily_wager
{
char date[10];
protected :
int amount;
public :
Payment();
~Payment();
void show();
};
- Name the type of Inheritance depicted in the above example.
- Name the member functions accessible through the object of class Payment.
- From the following, Identify the member function(s) that can be called directly from the object of class Daily_wager class
show()
getd()
get()
- Name the base & derived class of Daily_wager class.
4. (a) Write a function in C++ which accepts a character array and its size as an arguments and reverse
that array without using second array and library function. 4
Example : if the array is having
"Computer Science"
Then after reversal it should rearranged as
"ecneicS retupmoC"
- An array A[13][14] is stored in the memory along the column with each element occupying 4 bytes. Find out the Base address and address of the element A[3][7] if the element A[4][4] is stored at the address 1300. 4
- Write a function in C++ to delete a node containing names of student ,from a dynamically allocated stack of names implemented with the help of following structure : 3
struct student
{
char name[20];
student *next;
};
- Consider the following portion of a program , which implements names queue for Books . Write the definition of function Insert(), to insert a new node in the queue with required information 3
struct Book
{
char names[4][20];
};
class QueueofBooks
{
Book Q[10];
public :
int front ,rear;
QueueofBooks()
{
front=rear=-1;
}
void Insert();
void Delete();
};
- Evaluate the following postfix expression using a stack and show the contents of stack after execution of each operation: 2
False,True , False , True ,Not, Or, True , Or, Or ,And
5. a) Asuming a binary file FUN.DAT is containing objects belonging to a class LAUGHTER( as defined below). Write a user defined function in C++ to add more objects belonging to class LAUGHTER at the bottom of it. 4
Class LAUGHTER
{
int idno;
char Type[5];
char Desc[255];
PUBLIC:
void Newentry(){ cin>> Idno; gets(Type); gets(Desc);}
void Showonscreen() { cout<<Idno<<" "<<Type<<endll<<Desc<<endl;}
};
b). Assuming that a text file named TEXT1.TEXT already contains some text written into it, write a function named vowelwords(), that reads the file TEXT1.TEXT and creates a new file named TEXT2.TEXT,which shall contain only those words from the file TEXT1.TEXT which does not
start with an uppercase vowel(i.e, with 'A','E','I','O','U'). FOR example, if the file TEXT1.TXT
contains.
Carry umbrella and Overcoat when it Rains
then the file TEXT2.TXT shall contain
Carry when it Rains. 3
6. (a) What do you understand by Primary Key. 2
- Consider the following tables Employee and salary. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii) 6
Table : Employee
Eid | Name | Deptid | Qualification | Sex |
1 | Deepali Gupta | 101 | MCA | F |
2 | Rajat Tyagi | 101 | BCA | M |
3 | Hari Mohan | 102 | B.A | M |
4 | Harry | 102 | M.A | M |
5 | Sumit Mittal | 103 | B.Tech | M |
6 | Jyoti | 101 | M.Tech | F |
Table : Salary
Eid | Basic | DA | HRA | Bonus |
1 | 6000 | 2000 | 2300 | 200 |
2 | 2000 | 300 | 300 | 30 |
3 | 1000 | 300 | 300 | 40 |
4 | 1500 | 390 | 490 | 30 |
5 | 8000 | 900 | 900 | 80 |
6 | 10000 | 300 | 490 | 89 |
- To display the frequency of employees department wise.
- To list the names of those employees only whose name starts with 'H'
- To add a new column in salary table . the column name is total_sal.
- To store the corresponding values in the total_sal column.
- Select name from employee where eid=(select eid from salary where basic= (select max(basic) from salary));
- select max(basic) from salary where bonus >40;
- Select count(*) from employee group by sex;
- select Distinct deptid from Employee;
- (a) State and prove the Distributive law algebraically. 2
- Write the equivalent POS expression of following SOP form
F (x,y,z)= ∑ (0,2,4,6) 2
- Draw the Logical circuit of the following expression with the help of NAND gate only 1
x+yz
- Obtain the simplified form of a Boolean expression using K-Map. 3
F(a,b,c,d)=∑(0,1,2,3,4,7,11,12,14)
7. (a) What are cookies. 1
(b) Define the term Bandwidth. Give unit of Bandwidth. 1
(c) Expand the following terminology :
(i) Mbps (ii) GSM 1
(d) Define the term Firewall. 1
- A company in Reliance has 4 wings of buildings as shown in the diagram:
Center to center distances between various Buildings:
W3 to W1 50m
W1 to W2 60m
W2 to W4 25m
W4 to W3 170m
W3 to W2 125m
W1 to w4 90m
Number of computers in each of the wing:
W1 150
W2 15
W3 15
W4 25
Computers in each wing are networked but wings are not networked. The company has now decided to connect
the wings also.
i) Suggest a most suitable cable layout of the connection between the wings. 1
ii) Suggest the most suitable wing to house the server of this company with a suitable reason. 1
iii) Suggest the placement of the following devices with justification: 1
1) Internet connecting device/modem
2) Switch / Hub
iv) The company is planning to link its head office situated in India with the offices at Reliance. Suggest an economic way to connect it; the company is ready to compromise on the speed of connectivity. Justify your answer. Guess Paper – 2008
Class – XII
Subject – Computer Science
Q. 1.
- Name the header file to which the following belong: (1)
(i) gets( )
(ii) open( ) - What is copy constructor? What do you understand by constructor overloading? (2)
- Rewrite the following program after removing the syntactical error(s), if any Underline each correction, (2)
#include <iostream.h>
void main( )
{ struct TV
{ char Manu_name[20];
char Tv_Type;
int Price = 17000;
} New Tv;
gets(Manu_name);
gets(Tv_Type);
} - Find the output of the following program: (3)
#include<iostream.h>
#include<string.h>
class country
{ char *country name;
int length;
public:
country ( ) {Iength =0; country_name=new char [length+1];}
country (char *s)
{ length = strlen(s); country_name=new char [length +1];
strcpy (country_name, s);
}
void display () { cout<< country_name <<endl;}
void Replace (country & a, country & b)
{ length a.length + b.length;
delete country_name;
country_name=new char [length + 1];
strcpy (country_ name, a.country_name);
strcat (country_name, b.country name);
}
};
void main ( )
{ char * temp = "India";
country country1 (temp), country2 ("Nepal"), country3 ("China"), S1,S2;
S1.Replace (country1, country2);
S2.Replace (S1,country3);
S1.display( );
S2.display ( );
} - Find the output of the following program: (2)
#include<iostream.h>struct list
{ int a, b;
};
void main()
{
list s[3]={{12,14},{2,3},{4,5}};
for(int i=0;i<3;i++)
cout<<s[i].a+s[i].b<<"\t";
}
- What is the importance of constructor in object oriented programming? Explain with the help of an example. (2)
Q. 2.
- What is the difference between Multilevel and Multiple Inheritance in context to object oriented programming? (2)
- Given a class as follows: (2)
class Match
{ int Time;
public:
Match (int y) { Time = y;} //Constructor 1
Match (Match& t); //Constructor 2
};- Create an object, such that it invokes Constructor 1.
- Write complete definition for Constructor 2.
c. Define a class ELECTION with the following specifications . Write a suitable main ( ) function also to declare 3 objects of ELECTION type and find the winner and display the details . (4)
Private members :
Data : candidate_name , party , vote_received
Public members :
Functions : enterdetails ( ) – to input data
Display ( ) – to display the details of the winner
Winner ( ) – To return the details of the winner trough the object after comparing the votes received by three candidates .
- Create an object, such that it invokes Constructor 1.
- Answer the questions (i) to (iii) based on the following code:
class toys
{
char Code;
char Manufacturer [10];
public:
toys( );
void Read_toy_details ( );
void Disp_toy_details( );
};
class electronic : public toys
{
int no_of_types;
float cost_of_toy;
public:
void Read_elect_details ( );
void Disp_elect_details ( );
};
class infants : private electronic
{
int no_of_buyers;
char delivery date[10];
public:
void Read_infant_details ();
void Disp_jnfant_details();
};
void main ( )
{ infants MyToy; }
(i) Mention the member names which are accessible by MyToy declared in main () function. (1)
(ii) What is the size of MyToy in bytes? (1)
(iii) Mention the names of functions accessible from the member function Read_infant_details () of class printer. (2)
Q. 3.
- Write a function in C++ which accepts an integer array and its size as arguments/ parameters and then assigns the elements into a two dimensional array of integers in the following format: (4)
If the array is 1, 2, 3, 4, 5, 6 | If the array is 1, 2, 3 | |||||||
0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |
- An array MAT [15] [7] is stored in the memory along the column with each element occupying 2 bytes of memory. Find out the base address and the address of element MAT [2] [5], if the location of MAT [5] [4] is stored at the address 100. (4)
- What is circular queue? How is it different from simple queue?
Write a function in C++ to perform Delete operation in dynamically allocated Queue containing names of students. (4)
- Write a function in C++ called shift( ) to rearrange the matrix as shown . Do not use parallel matrix . (2)
Original Matrix Rearranged Matrix
1 2 -3 -2 -3 -2 1 2
0 -1 2 1 -1 0 2 1
-3 9 -4 4 -3 -4 9 4
- Evaluate the following postfix expression using a stack and show the contents of the stack after execution of each operation. (2)
10, 20,*,10,2,/,+
Q. 4.
- Write a function to count the number of VOWELS present in a text file named "PARA.TXT". (3)
- Write a function in c++ to open the text file "oneindia.dat" and add one more record of following structure type. The file has already existed with some records. (3)
struct India
{
char name[25];
float amount;
};
Q. 5.
a. What do you understand by Foreign key and cardinality in a relation. (2)
b. Consider the following tables SCHOOL and ADMIN. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii). (1x4 + ½ x 4 = 6)
Table: SCHOOL
CODE | TEACHERNAME | SUBJECT | DOJ | PERIODS | EXPERIENCE |
1001 | RAVI SHANKAR | ENGLISH | 12/03/2000 | 24 | 10 |
1009 | PRIYA RAI | PHYSICS | 03/09/1998 | 26 | 12 |
1203 | LISA ANAND | ENGLISH | 09/04/2000 | 27 | 5 |
1045 | YASHRAJ | MATHS | 24/08/2000 | 24 | 15 |
1123 | GANAN | PHYSICS | 16/07/1999 | 28 | 3 |
1167 | HARISH B | CHEMISTRY | 19/10/1999 | 27 | 5 |
1215 | UMESH | PHYSICS | 11/05/1998 | 22 | 16 |
Table: ADMIN
CODE | GENDER | DESIGNATION |
1001 | MALE | VICE PRINCIPAL |
1009 | FEMALE | COORDINATOR |
1203 | FEMALE | COORDINATOR |
1045 | MALE | HOD |
1123 | MALE | SENIOR TEACHER |
1167 | MALE | SENIOR TEACHER |
1215 | MALE | HOD |
- To display TEACHERNAME, PERIODS of all teachers whose periods less than 25 and name start with either R or U..
- Display all from table SCHOOL from where period is between 10 and 20.
- To display TEACHERNAME, CODE and DESIGNATION from tables SCHOOL and ADMIN for female teacher..
- To display CODE, TEACHERNAME and SUBJECT of all teachers who have joined the school after 01/01/1999.
- SELECT MAX(EXPERIENCE), SUBJECT FROM SCHOOL GROUP BY SUBJECT;
- SELECT TEACHERNAME, GENDER
FROM SCHOOL, ADMIN
WHERE DESIGNATION = 'COORDINATOR' AND
SCHOOL.CODE=ADMIN.CODE ;
vii) SELECT DESIGNATION, COUNT(*) FROM ADMIN
GROUP BY DESIGNATION HAVING COUNT(*) <3;
viii) SELECT COUNT(DISTINCT SUBJECT) FROM SCHOOL;
Q. 6.
- State and verify Absorption law. (2)
- Write the equivalent expression for the following logical circuit: (2)
- Express P' + QR' in canonical SOP form. (2)
- Reduce the following Boolean expression using K-Map: (2)
F(P,Q,R,S)=∑(l,3,5,8,11,12,15)
Q. 7.
(a) Write the difference between coaxial and optical fiber cable. (1)
(b) Explain the following terms in short : (1)
(i) GSM ii) CDMA
(c) What us the difference between Message switching technique and Packet switching technique ? (1)
(d) Expand the following : (1)
TCP/IP, XML, CDMA, WLL
(f) Haldiram Private Ltd. has decided to network all its offices spread in five buildings of Company (Shown below). No. of computers given in square brackets [ ].
The distance between buildings are given below:
Between 1 & 2 | 20 Mts | Between 3 & 5 | 70 Mts | |
Between 2 & 3 | 50 Mts | Between 1 & 5 | 65 Mts | |
Between 3 & 4 | 120 Mts | Between 2 & 5 | 50 Mts | |
Between 4 & 5 | 30 Mts |
(i) Suggest cable layout(s) for connecting the buildings. 1
(ii) Suggest the most suitable building to install the server of this organization with a suitable reason, with justification. 1
(iii) Building-3 is used for many critical operations. It is tried that PC gets maximum possible bandwidth. Which network device is/should be used for this? 1
(iv) The company also has another office in the same city but at a distant location about 25-30 kms away. How can link be established with this building. (i.e. suggest the transmission medium). 1
No comments:
Post a Comment