KendriyaVidyalayaSangathan Kolkata Region Third Pre-Board Examination : 204-5 Please check that this question paper contains 7 questions. Please write down the Serial Number of the question before attempting it. 5 minutes time has been allotted to read this question paper. The students will read the question paper only and will not write any answer on the answer-book during this period. COMPUTERSCIENCE Time allowed : 3 hours Class : XII Maximum Marks : 70 Note : (i) (ii) All questions are compulsory. Answer the questions after carefully reading the text.. (a) What is the difference between local variable and global variable? Also, give a suitable C++ code to illustrate both. 2 (b) Name the inbuilt function and the related header file that is used to change lower case to upper case letter. (c) Aashu has just started working as a programmer in ZENITH SOFTWARE Company. In the company she has got her first assignment to be done using a C++ to reverse words of a string individually. But she has committed some mistakes while writing the code and is not getting the desired result. Rewrite the correct code underlining the corrections done. 2 For example, if user enter : computer science it should display : retupmocecneics #include<iostream.h> #include<string.h> void main( ) inti, k = 0; char str[80]; word[80]; cout<< Enter any string (max. 80 chars) <<endl; gets(str); strcat(str, ); for(i=0; str[i]!= \0 ;i++) Page of
if(str[i]!= ) word[k] = str[i]; k=k+; else while(k>0) cout<<word[--k]; cout<<str[i]; (d) Find the output of the following program : 2 #include<iostream.h> void main( ) int Data[ ] = 4, 6, 0, 2; int *arrange = Data; for(int k=; k<=3; k++) cout<<*arrange<< @ ; arrange++; cout<<endl; for(k=; k<=4; k++) (*arrange)* = 3; --arrange; for(k=; k<5; k++) cout<<data[k-]<< % ; cout<<endl; (e) Obtain the output from the following C++ program as excepted to appear on the screen after its execution. 3 #include<iostream.h> structmybox int Length, Breadth, Height; ; void Dimension(MyBox M) cout<<m.length<< x <<M.Breadth<< x ; cout<<m.height<<endl; void main( ) MyBox B = 0, 5, 5, B2, B3; ++B.Height; Dimension(B); B3=B; ++B3.Length; B3.Breadth++; Dimension(B3); B2 = B3; Page 2 of
B2.Height+ = 5; B2.Length--; Dimension(B2); (f) Read the following C++ code carefully and find out of the given options (i) to (iv) are the expected correct output(s) of it. Also, justify the answer. #include<iostream.h> #include<stdlib.h> constint Check = 5; void main( ) randomize( ); int Option = 5, Value; for(int z=; z<=4; z++) Value = Check + random(option); cout<<value<< % ; Option--; 2 (i) 9%6%5%8% (ii) 4%8%5%6% (iii) 9%6%4%8% (iv) 9%6%5%6% 2. (a) How do abstraction and encapsulation complement each other? Write an example using C++ to illustrate the concept. 2 (b) Answer the following questions (i) and (ii) after going through the 2 following class : class Program inttimelimit; //In Hours public: Program( ) //Function TimeLimit = 8; cout<< Inauguration <<endl; ~Program( ) //Function 2 cout<< Valedictory Function <<endl; void Session(int S=) //Function 3 cout<< Session <<S<< is on <<endl; Program(intTimeLimit) //Function 4 Page 3 of
Time = TimeLimit; cout<< Inauguration <<endl; ; (i) In Object Oriented Programming, what is Function 2 referred to as and when does it get invoked / called? (ii) In OOP, which concept is illustrated by Function and Function 4 together? (c) Define a class Admission in C++ with the following description : 4 Private Data Members AdmNo - to store Admission Number of type long Name - to store Applicant s Name of type string Percent - to store Percentage of marks of type float Stream - to store Stream of type string Private Member Functions A member function AdmStream( ) to find the Stream as per the Percentage obtained by a student. Equivalent Percentage range and the respective stream is shown as follows : Percentage Stream >=70 Science less than 70 and >=50 Commerce less than 50 and >=33 Humanities less than 33 Not Applicable Public Member Functions A function Registration( ) to allow user to enter values for AdmNo, Name and Percent. Also, this function should call AdmStream( ) to assign Stream. A function Display( ) to allow user to view the content of AdmNo, Name, Percent and Stream on screen. (d) Consider the following C++ code and answer the questions from (i) to (iv) : 4 class Publisher long PID; //Publisher Identification Number char PName[20]; protected : char Description[40]; void Allocate( ); public : Publisher( ); void Assign( ); void Show( ); ; class Branch Page 4 of
int BID; //Branch Identification Number char BName[20]; protected : char Address[30]; public : Branch( ); void Input( ); void Output( ); ; class Author : private Publisher, public Branch int AID; //Author Identification Number char City[20], Country[20]; public : Author( ) void Enter( ); void Display( ); ; (i) Which type of Inheritance is shown in the above example? (ii) Write the names of those member functions, which can be directly accessible from the objects of class Author. (iii) How many bytes will be required by an object belonging to class Author? (iv) Write the names of all members, which are accessible from member functions of class Branch. 3. (a) Write code for a function void Transfer(intArr[ ], int size) in C++, to divide all those array elements by 7 which are divisible by 7 and multiply other array elements by 3. Example : If the original content of the array Arr is Arr[0] Arr[] Arr[2] Arr[3] Arr[4] 3 2 2 35 42 8 The modified content will be : Arr[0] Arr[] Arr[2] Arr[3] Arr[4] 3 36 5 6 54 (b) An array A[40][30] is stored along the row in the memory with each element requiring 4 bytes of storage. If the base address of the very first element of A is 4500, find out the location of A[0][20]. Also find the total number of bytes required by the array A in the memory. 3 (c) Write a user defined function DispRowCol(int A[ ][3], int S, int R) in C++ Page 5 of
to display all alternate elements from two-dimensional array A. (Starting from A[0][0]). 2 For example if the content of 2D array of dimension 3 3 is : 2 45 67 33 90 76 2 43 59 The output should be : 2 67 90 59 (d) Evaluate the following postfix notation of expression : 5 3 2 + / 7 + 2 * 2 (e) Write a function in C++ to delete an element into dynamically allocated Queue where each node contains a real number as data. Assume the following definition of NODE for the same : struct NODE float num; NODE *Link; ; 4 4. (a) Observe the program segment given below carefully and the questions that follow: class Stock intino, Qty ; char Item[20]; public: void Enter() cin>>ino; qets(item); cin>>qty; void Issue(int Q) Qty+=O; void Purchase(int Q) Qty-=Q; intgetino () return Ino; Page 6 of
; void PurchaseItem(intPino,intPQty) fstream File; File.open("STOCK.DAT", ios::binary ios::in ios::out); Stock S; int Success=0; while (Success==0&&File.read((char*)&S,sizeof(S))) if (Pino==S.GetIno()) S.Purchase(PQty); // Statement // Statement 2 Success++; if (Success==) cout<<"purchase Updated"<<endl; else cout<<''wrong Item No"<<endl; File.close() ; (i) Write statement to position the file pointer to the appropriate place so that the data updation is done for the required item. (ii) Write statement 2 to perform the write operation so that the updation is done in the binary file. (b) Write a function in C++ to read the content of a text file "KOLKATA.TXT' anddisplay all those lines on screen, which are either starting with 'S' or startingwith 'M'. 2 (c) Write a function in C++ to search for the details (PhoneNum and Calls) ofthose Phones, which have more than 800 calls from a binary file "Phone.dat". Assuming that this binary file contains records/objects of class Phone, whichis defined below : 3 class Phone char PhoneNum[0]; int Calls; public: void Get( ) gets(phonenum); cin>>calls; void Billing() Page 7 of
; cout<<phonenum<<"#"<<calls<<endl; intgetcalls() return Calls; 5. (a) A table 'game' has 3 columns and 20 rows and another table 'game2' has the same column as game and 5 rows. 5 rows are common in both the table. If we take union, what is the degree andcardinality of the resultant table? 2 Note : Answer the questions (b) and (c) on the basis of the following tables Students and Streams (b) Write MYSQL queries for the following: 4 (i) To display Students' information in ascending order using Name. (ii) To display Adno, Name, Sex and Average from Student's table and Stream name(sname) and Place from Stream table with respect to Scode. (iii) To add the following information into the student table. 999 Deepak Sharma 83 M 2222 Page 8 of
(iv) To display Science Stream Students' information. (c) Write the output of the following SQL commands: 2 (i) SELECT SUM(Average) FROM Students WHERE Sex = M ; (ii) SELECT DISTINCT(Scode) FROM Students; (iii) SELECT Place, COUNT(*) FROM Streams GROUP BY Place; (iv) SELECT Name, Average*0 TOTAL FROM Students WHERE Scode IN (, 444 ); 6. (a) Prove the following Boolean Expression : (a' + b'). (a' + b). (a + b') = a'. b' 2 (b) Obtain the Boolean Expression for the logic circuit shown below : 2 (c) Write the Sum of Product form of the function X(A, B, C) for the following truth table : (d) Obtain the minimal form for the following Boolean Expression using Karnaugh s Map : F(A, B, C, D) = (, 3, 4, 5, 6, 7, 2, 3) 3 Page 9 of
7. (a) Two students in the same class sitting inside the same room have connected their laptops usingbluetooth for working on a group presentation. What kind of network have they formed? (b) What do you mean by a modem?why is it used? (c) Expand the following : TCP VoIP (d) Mr. Rohan wants to prevent unauthorized access to/from his company's local area network. Write thename of the system, which he should install to do the same. (e) Expertia Professional Global (EPG) is a professional consultancy company. The company is planning to set up their new offices in India with its hub at Kolkata. As a network adviser, you have to understand their requirement and suggest to them the best available solutions. Their queries are mentioned as (i) to (iv) below : Page 0 of
(i) What will the most appropriate block, where EPG should plan to install their server? (f) (g) Page of