You are on page 1of 8
Practice Paper 9 (Answers) 1. (@) The fundamental idea of Object-Oriented Programming is its emphasis on the objects rather than procedure. In procedural programming paradigm, data is shared among all the functions. Its emphasis is on doing things rather than the data being used. 141 ®) @ stdio.h (i) iomanip.h (c) The errors are corrected and underlined : #indude // Error 1 void main ( ) { int j=99, a; // Error 2 float u=10.0; cin >>a; Af Error 3 while (2<=)) { A/ Error 4 } (@) The output is as : tt Vot¥o+l 34 6 10 (©) The output is as : -416195-8 Vor Vot Vet Vet V (f) The required function with program is : 11 The required function is: double seriessum(double x, int n) { % double sum = 1, fact = 1, term, for(int i++) { fact = fact * i; term = (t/fact) * ( pow(x, i); sum = sum + tem; 3 return sum; + void main() { Ys int _n; double $, x; Computer Science (C++)—12 ay cout << “Enter the value of n and x"; cin >> n >> x; S = seriessum(x,n); % cout << "Sum of the series is “<> Pldno; cout << “Charges per day "; cin >> Charges; cout << “No of days *; cin >> Nodays; Totcharges = Calcharge(); h void Out_data() { 1 cout << "Patient id << Pldno << endl; Computer Science (C++)—12 @) cout << “Charges * << Charges << endl; cout << "No. of days" << Nodays << endl; cout << “Total charges * << Totcharges; + hi (d) @ Base class : vehide Yeth Derived class : bus Gi) Data members are : make[20], load, passenger 1 (iii) No data member is accessed 1 (iu) Yes 1 (@) The function is as : i Function to check whether an array is sorted or not. int Check _Array(int A[10]) { int fla for(int j iRAD] < AGi+4]) { flag = 1; } else { flag break; } } if (fag == 1) return flag; for( J=O;}<99++) { 1 HAD] > AG+1) { flag = -1; } else flag = break; } t return flag; } () @) Loc(TIT]{J)) along the row = B + W x (N x (-L,) + 9-1) Given, B = 2000, W =, 2, N = 10,1 = 15,J =5,1,=1,1,=1 So, T[ISI[5] = 2000 + 2 x (10 x (15-1) + B- 1) 1 = 2000 +2 x (10 x 14 + 4) = 2000 + 2 x (140 + 4) = 2000 + 2 x 144 = 2000 + 288 = 2288 Computer Science (C++)—12 @) Gi) Loc( TIL) along the column = B + W x ((I-L,) + M x J- 1) Given, B = 2000, W = 2,M = 20,1 = 19,J =5,L,=1,L,=1 So, T[IS][5] = 2000 + 2 x (IS = 1) + 20 x G = 1) = 2000 + 2 x (14 + 20 x 4) = 2000 + 2 x (14+ 80) = 2000 + 2 x 4 = 2000 + 188 = 2188 (©) The function is as = ‘// Function to find the transpose of a matrix. void Transpose(int T141(5]) { int B(5IE4], i; for (i=0; i<5; i++) { forli=0; <4; j++) bEG) = TOIL; b cout<<"Transpose of @ matrix is \n"; for (i=0; i<5; i++) { for (§=0; 1<4; j++) { cout << bli] <<" °; } cout << “\n",} } (d) The necessary queue declaration is as : if Declares a queue structure struct node { float data node *link; hk // Function body to add queue elements node *add_Q(node *rear, float val) { node *temp; ‘temp = new node; temp->data = val; temp->link = NULL; rear->link = temp; rear = temp; return (rear); Computer Science (C++)—12 @) (@) Infix expression (((( A + B ) * C) +( D/ E)) - F) Operation Stack Status Output ( ( R a ( W ( «@ A a A + c(i A B ccs AB ) « AB+ * «e AB+ c (e AB+G ) a AB+C* + (+ AB+C® ( ce AB+C* D (+ AB+C*®D. f +y AB+C*D. E «ay AB+C®DE ) AB+C*DE/ ) ( AB+C*DE/ 7 © AB+C*DE/ F c AB+C*DE/+F ) EMPTY AB+C*DE/ +F - ‘Ans = AB+C*DE) +F— (a) The stream, which is used to write in the file, is called ofstream. (®) The function is as : void vowelwords() { fstream afile; char ch{10], cht = *%; afile.open(*PARA.TXT", ios::in); int count=0; clser(); while(afile) { afile getline(ch,10," if(strlen(ch)==0) break; Computer Science (C++)—12 @) Ve % ve e ch[0]=toupper(ch[0]); if (( ch[0] ==") [| (ch[0] =="E°) || (chLt Ye count++; + } afile.close(); % cout<<"Number of words starting with vowel "< 30000) S.SHOWIT(); } fin.close(); (@) ( The coordinator between database and the users is DBMS. 141 (i) The relational algebra operation ‘selection’ produces a horizontal subset of a relation, (6) @ Select Name from STUDENT where Sex (i) Select distinct (Department) from STUDENT; 1 (iii) CREATE view STUD as select Name, Age, Fee FROM STUDENT WHERE Department = ‘History’ OR Department = ‘Hindi’; oth (@) UPDATE STUDENT SET Fee = Fee + (Fee * 0.1) WHERE Department = ‘Computer’; YotV% (v) COUNT(DISTINCT Fee) 6 AVG(Fee) % 216 Computer Science (C++)—12 6) (vii) MIN(Fee) MAX(Fee) Ys 200 300 (viii) SUM(ee) 800 =. (a) The canonical sum of product is : 141 (XV)RZ) = (YR) a’ (X’Yy + (X'2Z)" () The truth table is : x Y Zz Max term Hl-|-|-lelelele rlHlolol-l-lele rlolelolHlolHlo rlololHlolH|Hlo Product of sum is : F = (X+Y+Z)(X4+Y'+Z/)(X'+Y+Z'(X'+Y'4Z) ©) The simplified form is : Vor VerVer Vs F=UV'W +UV+UW+X 1 (a) The circuit diagram for F = AB'G + C'E is : Here we have to draw the circuit using universal gate, ie. NAND and NOR. In the given circuit diagram we are using NAND gate and the formula (WY =X + 141 A csp » (Boy c o — ABIC + CE F (CEY Computer Science (C++)—12 @) 7. (a) Local Area Network (LAN): These networks connect computer equipment and other terminals distributed in a localized area, e.g., a university campus, factory, office, ete. Yetl Wide Area Network (WAN): These networks span in a large area - possibly several continents, That is, the interconnected communication facilities in different parts of a country or used as public utility. (b) The two reasons are : Yet @ In the network, we can share the resources as well as data. Gi) In the network, we can improve the data communications speed and accuracy. (c) @ IP address 1 (@) @ Stealing a mouse from someone’s computer. 1 (@) @ The most suitable cable layout is : Ye Building 3[110] Building 5{70] Star topology will be the most suitable topology. % (i) The most suitable building to install the server is Building 3 as it has maximum number of computers. Yt Git) Repeater 1 Gv) Link can be established with either optical fibre or satellite. 1 (f ) Facebook (www:facebook.com) and twitter (www.twitter.com) Voth (g) Crimes committed primarily through Internet contact include: credit card fraud, identity theft, child pornography, indecent chatroom behavior, software and ia piracy, website vandalism, release of viruses and worms, spam marketing, invasion of privacy, cyber-spying, most forms of hacking, etc. called cyber crime. 1 met Computer Science (C++)—12 @)

You might also like