Sei sulla pagina 1di 6

PREBOARD I 2011-12 KENDRIYA VIDYALAYA NO. 1, RAIPUR CLASS - XII (COMPUTER Sc.

) Time Allowed : 3 hours


Note : (i) All questions are compulsory. (ii) Programming Language : C++

Maximum Marks : 70

1. (a) What do you understand by actual arguments and formal arguments? Give one example to illustrate the both. 2 (b) Read The following code and answer the questions (i) & (ii) 1 void main() { char Name[20]; int RollNo = 20; cin>>Name; puts(Name); cout<<RollNo; } (i) What are the header files to be included? (ii) If the value of Name to be given during program execution is Good One, What is the output? (c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. 2 #include[iostream.h] typedef char Text(80) ; void main ( ) { Text T= "Indian"; int Count=strlen(T) ; cout<<T<<'has'<<Count<< 'characters' <<end1; } (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; e1se 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]<<end1 ; } void main ( ) { int Array [ ] = {30, 20, 40, 10, 60, 50}; ChangeArray (3, Array, 6) ; Show (Array, 6) ; }

(e) Find the output of the following program: 2 #include<iostream.h> void main ( ) { int Track [ ] = {10, 20, 30, 40}, *Striker ; Striker=Track : Track [1] += 30 ; cout<<"Striker>"<<*Striker<<end1 ; Striker =10 ; Striker++ ; cout<<"Next@"<<*Striker<<end1 ; Striker+=2 ; cout<<"Last@"<<*Striker<<end1 ; cout<< "Reset To" <<Track[0] <<end1 ; } (f) Go through the C++ code shown below, and find out the possible output or outputs from the suggested Output Options (i) to (iv). Also, write the least value and highest value, which can be assigned to the variable Guess. 2 randomize ( ) ; int Array[10] = {1,2,3,4,5,6,7,8,9,10}, N=6; int Guess = random(Array[N]); for(int i=Guess; i>=1; i--) { cout<<i; If (i != 1) cout<<*; } OUTPUT (I) 5*4*3*2*1* (iii) 4*3*2*1 (II) 3*2*1* (iv) 7*6*5*4*3*2*1 2. (a) Differentiate between constructor and destructor with respect to object oriented programming. 2 (b) 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 function [I] to [IV]. 2 #include<iostream.h> void Print ( ) // Function [I] { for (int K=1 ; K<=60 ; K++) cout<< "-" ; cout<<end1 ; } void Print (int N) // Function [II] { for (int K=1 ; K<=N ; L++) cout<<"*" ; cout<<end1 ; } void Print (int A, int.B) // Function [III] { for (int K=1. ;K<=B ;K++) cout <<A*K ; cout<<end1 ; } void Print (char T, int N) // Function [IV] { for (int K=1 ; K<=N ; K++) cout<<T ; cout<<end1; } void main ( ) { int U=9, V=4, W=3; char C='@' ; Print (C,V) ; Print (U,W) ; }

(c) Define a class Hotel in C++ with the following specification: 4 Private Members : A data member Customer Name of type string A data member Room Number of type integer A data member Room Type of type string A data members Room Charges of type float A data member Other Charges of type float A member function BILL() that return Bill Amount Claculated as sum of Room Charges and Other Charges then discounted by 10% of Total Charges. Public Members : A constructor function that initializes Room Number & Room Type with the help of parameters passed in the constructors. A function CHECKIN() to allow user to enter values for Customer Name, Room Number, and Other Charges and assign the value for Room Type as Room Charges on the basis of Room No which will be calculates as Room No Room Type Room Charges From 101 to 120 Single Bed 900 From 201 to 215 Single Bed AC 1500 From 301 to 310 Double Bed AC 2500 A function CHECKOUT() to allow user to view the content of all the data members and call the function BILL() to display the Bill Amount. (d) Answer the questions (i) to (iv) based on the following: class Student { int Rno; char Name [20] ; float Marks; protected: void Result( ) ; public: Student( ) ; void Register( ); void Display( ) ; }; class Faculty { long FCode; char FName[20]; protected: float Pay; public : Faculty ( ) ; void Enter ( ) ; void Show ( ) ; }; class Course : public Student, private Faculty { long CCode [10]; char CourseName [50] ; char StartDate[8], EndDate[8] ;

public : Course ( ) ; void Commence ( ) ; void CDetail ( ) ; }; (i) Which type of inheritance is illustrated in the above C++ code? (ii) Write the names of the all data members, which is/are accessible from member function Commence of class Course. (iii) Write the names of member functions, which are accessible from objects of class Course. (iv) Write the name of all the members, which are accessible from objects of class Faculty. 3.(a) Write a function in C++ that takes an array of 12 numbers as arguments and interchange each two numbers with next two number as given in example: eg if the initial array is as follows : 3 3 23 5 8 50 43 78 32 11 22 51 33 then after rearrangement array should be 5 8 3 23 78 32 50 43 51 33 11 22 (b) An array P[20] [50] is stored in the memory along the column with each of its element occupying 4 bytes, find out the 1ocation of P[15][10], if P[0][0] is stored at 5200. 3 (c) Write a function in c++ to insert a new element in a dynamically allocated Stack containing names of Countries. 4 (d) Define a function SUM2COL ( ) in C++ to return sum the first and last column elements for a two dimensional integer array passed as the argument of the function. 2 (e) Evaluate the following postfix notation of expression: 2 (Show status of Stack after each operation) False, True, NOT, OR, True, False, AND, OR 4. (a) Observe the program segment given below carefully and fill the blanks in Statement 1 and Statement 2 using seekg() and tellg() functions for performing the required task. 1 #include <fstream.h> class Employee { int Eno;char Ename[20]; public: //Function to count the total number of records int Countrec(); }; int Item::Countrec() { fstream File; File.open(EMP.DAT,ios::binary|ios::in); ______________________ //Statement 1 (Places the pointer at end-of-file) int Bytes = ____________________ //Statement 2 (Returns current position of pointer) int Count = Bytes / sizeof(Item); File.close(); return Count; } (b) Write a function in C++ to count the no. of "Me" or "My" words present in a text file "DIARY. TXT".

(c) Write a function in C++ to search for a BookNo from a binary file "BOOK.DAT", assuming the binary file is containing the objects of the following class BOOK. The user should enter the Book No and the function should search and display the details of the book. 3 class BOOK { int Bno; char Title[20]; public: int RBno(){return Bno;} void Enter(){cin>>Bno;gets(Title);} void Display(){cout<<Bno<<Title<<endl;} }; 5. (a) What do you understand by Degree and Cardinality of a table? 2 (b) Consider the following tables RESORT & OWNEDBY and answer the questions (I) & (II) parts of this question:

(I) Write SQL commands for the following statements 4 (i) To display RCODE and PLACE of all 5 STAR in the alphabetical order of place. (ii) To display maximum and minimum rent for each type of resort. (iii) To display details of all the resorts which are started after 31-Dec-05. (iv) Display the owner of all 5 STAR resorts from the tables RESORT & OWNEDBY. (II) Give the output for the following SQL queries: 2 (i) SELECT MIN(RENT) FROM RESORT WHERE PLACE = KERALA; (ii) SELECT TYPE, STARTDATE FROM RESORT WHERE TYPE = 2 STAR ORDER BY RENT. (iii) SELECT PLACE, OWNERFROM OWNEDBY WHERE PLACE LIKE %A; (iv) SELECT RCODE, RENT FROM RESORT A, OWNEDBY B WHERE A.PLACE = B.PLACE AND STARTDATE >= 01-DEC-07 6. (a) State and verify Associative Law using Truth Table. 2 (b) Write the equivalent expression for the following logical circuit: 2

(c) Write POS from for the following Boolean expression: U. (W + Z) (d) Simplify the following Boolean expression using K-Map. F(P, Q, R, S) = (0,2,5,7,8,10, 13,15) 7. (a) (b) (c) (d) Compare any two switching techniques. If someone has hacked your Website, to whom you lodge the Complain? What do you mean by IP Address? How is it useful in Computer Security? Knowledge Supplement organisation has set up its new center at Mangalore for its office and web based activities. It has 4 blocks of buildings as shown in the diagram below:

2 2

1 1 1

Suggest a cable layout of connections between the blocks. Suggest the most suitable block to house the server of this organization with a suitable reason. (iii) Suggest the placement of the following devices with justification (a) Repeater (b) Hub/Switch (iv) The organization is planning to link its front office situated in the city in a hilly region where cable connection is not feasible, suggest an economic way to connect it with reasonably high speed? (e) What do you mean by Spam Mails? How can you protect your mailbox from Spams? 1 (f) Mention any two advantages of Open Source Software over Proprietary Software. 1 (g) What is the difference between Virus and Worms in the computers? 1

(i) (ii)

Potrebbero piacerti anche