The students who have taken computer science as a subject need to take the subject seriously at first. They should concentrate most of their attention on the programming part. As it is the most vital part of the subject. They should try to use flow charts and algorithm for their help. As this tools help you to learn programming.
Tuesday, April 8, 2008
Monday, February 11, 2008
New sample paper
Time Duration: 3 Hrs M. M. 70
1.
|
i) strcmp() ii) isalpha() iii) isalnum() iv) strcat()
#include<stdio.h> void main() { int s1, s2, num; s1=s2=0; for(x=0;x<11;x++) { cin<<num; if(num>0(s1+=num; else s2=/num; } cout<<s1<<s2; }
1/x-3!/x2+5!/x3+7!/x4+9!/x5…….upto n terms (Note: the Symbol ! represents factorial of a number i. e., 4!=5x4x3x2x1)
For Example: Input String: The QUICK BROWN fox jumps over the LAZY LITTLE dog. Uppercase Vowels 6 Uppercase consonants 15 Lowercase Vowels 7 Uppercase consonants 13
| 2
1
4
2
1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2. |
| 2
2 2 2
2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3. |
Private Members : T_Code of type string No_of_Adults of type integer No_of_Children of type integer Distance of type integer TotalFare of type float Public Members : • A constructor to assign initial values as follows : T_Code with the word "NULL" No_of_Adults as 0 No_of_Children as 0 Distance as 0 TotalFare as 0 • A function AssignFare( ) which calculates and assigns the value of the data member TotalFare as follows : For each Adult Fare (Rs) For Distance (Km) 500 >=1000 300 <1000 & >=500 200 <500 For each Child the above Fare will be 50% of the Fare mentioned in the above table. For example : If Distance is 750, No_of_Adults = 3 and No_of_Children = 2 Then TotalFare should be calculated as No_of_Adults * 300 + No_of_Children * 150 i.e. 3 * 300 + 2 * 150 = 1200 • A function EnterTraveK ) to input the values of the data members T_Code, No_of_Adults, No_of_Children and Distance; and invoke the AssignFare( ) function. • A function ShowTraveK) which displays the content of all the data members for a Travel.
Class ZOO { char location[20]; int no_of_animals[10]; public: void readdata() { cin>>location; gets(no_of_animals); } void writedata() { cout<<location<<" "<<no_of_animals<<endl; } };
| 2
4
2
2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4 |
| 1 2
4
2 2
3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5 |
HOSPITAL
11, 'Ghulam Mustafa', 37, 'ENT',{25/02/07},250,'M'
| 2 2 2
2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
6 |
| 2
1 2 2 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
7 |
Approximate distances between these offices as per network survey team is as follows: Place From Place To Distance BackOffice Front Office 10KM Back Office Work Office 70 Meter Back Office East Office 1291 KM BackOffice West Office 790 KM Back Office South Office 1952 KM In continuation of the above, the company experts have planned to install the following number of computers in each of their offices : Back Office 100 Front Office 20 Work Office 50 East Office 50 West Office 50 South Office 50 (i) Suggest network type (out of LAN, MAN, WAN) for connecting each of the following set of their offices : • Back Office and Work Office • Back Office and South Office (ii) Which device you will suggest to be procured by the company for connecting all the computers with in each of their offices out of the following devices? • Switch/Hub • Modem • Telephone (iii) Which of the following communication medium, you will suggest to be procured by the company for connecting their local offices in New Delhi for very effective and fast communication? • Telephone Cable • Optical Fiber • Ethernet Cable (iv) Suggest a cable/wiring layout for connecting the company's local offices located in New Delhi. Also, suggest an effective method/technology for connecting the company's regional offices-"East Office", "West Office" and "South Office" with offices located in New Delhi. | 1 2
1 4 |
**********
*****
**********
Saturday, February 9, 2008
Sample papers
Class – XII
Subject – Computer Science (c++)
Set- 1
MM : 70 TIME : 3 HRS
General Instructions :
- This paper is not based on CBSE marking scheme ,and contains only important questions .
- In this question paper the number of questions are more than the question in actual board paper.
Q. 1. a) Define the following :
a. Data abstraction. b. Data Encapsulation c. Data Hiding
b) What is copy constructor? What do you understand by constructor overloading?
c) Name the header file to which following belog:
(i) atoi() (ii) isalnum() (iii) setw() (iv) puts()
d) What will be the output of the following program: [3]
#include<iostream.h>
#include<ctype.h>
#include<conio.h>
#include<string.h>
void PointersFun(char Text[], int &count)
{
char *ptr=Text;
int length=strlen(Text);
for(; count<length-2; count+=2, ptr++)
{
*(ptr + count) = toupper( * (ptr + count) );
}
}
void main()
{
clrscr();
int position=0;
char Data[]= "ChangeString";
PointersFun(Data, position);
cout<<Data<< "@"<< position;
cout.write(Data + 3, 4);
}
e) Find the output of the following program: [2]
#include<iostream.h>
#include<conio.h>
#include<string.h>
struct KEY
{
char word[10];
int count;
};
void changekeyword(KEY somekey);
void main()
{
KEY aKEY;
strcpy(aKEY.word, "#define");
aKEY.count=0;
changekeyword(aKEY);
cout<<aKEY.word<< "\t"<<aKEY.count<< "\n";
getch();
}
void changekeyword(KEY somekey)
{
strcpy(somekey.word, "const");
somekey.count=1;
cout<<somekey.word<< "\t" <<somekey.count<< "\n"; }
Q 2. a) 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 . ( 3 )
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 .
b. class data ( 2 )
{
int num ;
public :
data ( int n )
{ num = n ; }
void show ( )
{
cout << n <<endl;
}
};
class database : public data
{
char name[12];
data d ;
public :
__________________________
};
Fill in the blanks to define a constructor for the derived class assigning values of the data passed from main ( ) and to assign a data 15 o base class constructor data n .
c) Assume that you are writing a text based medieval video game. Your video game will have two types of
characters, the player and the monsesters. A player has to know the values of certain attributes of characters.
Health integer
Strength integer
Agility integer
Type of weapon String
Type of armor String
A player must be able to perform the following actions:
Move() /*Initialize Health by 16, Strength by 12, Agility by 14, Type of weapon by
Mace and Type of armor by leather */
Attackmonsester() // Display the following message 'Attack monsester with' Type of weapon Gettreasure() // Increments the value of the players health by 1
Define player class with the above specifications.
d) Consider the following C++ declarations and answer the questions given below:
class Aaryuved
{
void anyval();
protected:
int x,y;
void procval();
public:
void getvalA();
void putvalA() const;
};
class yoga : protected Aaryuved
{
int a, b;
protected:
int c, d;
void getvalB();
public:
void putvalB()
const ;
};
class Wisdom: private yoga
{
int p;
protected:
int q;
void getval();
public:
void showval();
};
- Name all the member functions, which are accessible by the objects of class wisdom.
- Name all the protected members of class yoga.
- Name the base class and derived class of yoga
- Name the data members, which are accessible from member functions of class wisdom
- Give the size of object of wisdom.
- Name the OOPS concept implemented above and its type
- Name the members accessible by function get putvalB().
e)
Array
Q.1 write a user define function xyz() which takes a two dimensional array with size N rows and N columnsas argument and store all 1)even in one dimensional array2) All odd in one dimensional array 3) display product of all the number except those which are not divisible by either 5 or 3.
Q. 2 write a user define function unitdigit() which takes a two dimensional array with size N rows and M columns as argument and store all i) unit digit ii) except unit digit
In two dimensional array. i.e
A[2][3] = 200 213
56 657
Resultant array should be
i) A[2][3] = 0 3
- 7
ii) A[2][3] = 20 21
5 65
Q. 3 write a user define function repeat() which takes a two dimensional array with size N rows and M columns as argument and convert all repeated element into zero.
Q. 4 write a user define function convert() which takes a one dimensional array with size N as argument and convert it into two dimensional array.
Suppose arr[6]= { 1,2,3,4,5,6}
Resultant array should be
Arr[6][6] = 2 1 4 3 6 5
- 1 4 3 6 0
- 1 4 3 0 0
- 1 4 0 0 0
- 1 0 0 0 0
- 0 0 0 0 0
- Write a function in C++ to replace the repeating elements in an array by 0 . The zeros should be shifted to the end. Do not use parallel array . The order of the array should not change. ( 2 )
Eg : Array : 10 , 20 , 30 , 10 , 40 , 20 , 30
Result : 10 , 20 , 30 , 40 , 0 , 0 , 0
f) 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
g) Convert to postfix form : ( 2 )
A + ( B * C ) ^ D / ( E * ( F – G ) – B ) * C ^ D
f) Evaluate the following postfix expression using a stack and show the contents of the
stack after the execution of each operation.
TRUE, FALSE, TRUE, FALSE, NOT, OR, TRUE, OR, OR, AND
3 , 5, + , 6 , 4 , - , * , 4 , 1 , - , 2 , ^ , +
3. a) . Write C++ function insert and delete in double link list. ( 2 )
b) Write a function in C++ to find the sum of alternate diagonal elements from a two dimensional array of type float. Use the array and its size as parameters with float as its return type.
c) An array A[25][10] is stored in memory in column wise with each of its element occupying 4 bytes . Find out the base address and the address of the element A[12][7] , if the location of A[15][9] is stored at address 7500 . ( 2 )
4. a) Observe the 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:
#include<fstream.h>
class employee
{
int Eno; char Ename[20];
public:
//Function to count the total number of record
int countrec();
};
int employee :: countrec()
{
employee item;
fstream file;
file.open("EMP.DAT",ios::binary|ios::in);
------------------------//statement 1
int Bytes = -------------------- //statement 2
int count = Bytes / sizeof(item);
file.close();
return count;
}
(b) Assuming that a text file UN.TXT contains some text written into it, write a function named countalpha() , countdigit() .
"between 1980 and 1995 a joint UNICEF-WHO effort raised global immunization coverage against 6 killer diseases- polio , tetanus, measles,whooping cough,diphtheriaand tuberculosis- from 5 to 80 percent.
Q.5
a. What do you understand by Foreign key and cardinality in a data base ( 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).
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 |
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 the contents of school table in descending order of teacher name.
- 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 the TEACHERNAME who have minimum PERIODS.
- Increase 2 years experience in all the female records.
- Delete all the records of subject physics.
- Insert a row in ADMIN TABLE.
- CREATE a view of table school. .
- Display the highest experience among all male teachers.
- Display code ,teachername, salary to be paid for the teacher using the table school ,where the salary to be paid = period * 507.50.
- 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;
6. (a) State and verify De-Morgan's, absorption Law in Boolean Algebra.
(b) Draw the circuit diagram for F = AB'C + C'B using NAND to NAND logic only.
(c) Write the Products of summand SOP form of the function G(U,V,W). Truth table representation of G is as follows:
U | V | W | G |
0 | 0 | 0 | 0 |
0 | 0 | 1 | 0 |
0 | 1 | 0 | 1 |
0 | 1 | 1 | 1 |
1 | 0 | 0 | 1 |
1 | 0 | 1 | 0 |
1 | 1 | 0 | 0 |
1 | 1 | 1 | 1 |
(d) Reduce the following Boolean expression using K - Map : 3
F (A, B, C, D) = ∑ (0, 1, 2, 3, 4, 5, 10, 11, 15) and
F (A, B, C, D) = ∏ (0, 6, 8, 9, 10, 11, 13, 15)
e) Write short note on principles of Duality.
f) Prove algebraically (X + YZ) =(X+Y) (X+Z)
g) A Boolean function F defined on three input variables A, B, C and is 1(one) if and if only if number of 0(zero) inputs is odd (e.g. F is 1(one) if A=0, B=1, C=1). Draw the truth table for the above function and express it in canonical sum of product form.
h) Simplify the following Boolean expression using K-map :
F(A, B, C, D)=m0 + m1 + m4 + m5 + m7 + m8
- Draw the diagram of digital circuit for the function
F(X,Y,Z)=(X+Y) . (X+Y) .(Y+Z)
7 (a) Write the difference between coaxial and optical fiber cable.
(b) Explain the following terms in short :
(i) GSM ii) CDMA
© What us the difference between Message switching technique and Packet switching technique ?
(d) Expand the following :
- TCP/IP,XML,CDMA,WLL
(e) Write two applications of Cyber Law.
(f) East and West Public Ltd. has decided to network all its offices spread
in five buildings of C.P. (Shown below).
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) Building3 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. 1
(i.e. suggest the transmission medium).