0% found this document useful (0 votes)
165 views12 pages

Sample Paper

This document contains sample questions from a Computer Science exam for Class 12 in India. It includes questions on C++ concepts like typedef, #define, header files, errors in code, and output of code snippets. It also has questions on classes and objects, file handling, SQL queries, Boolean algebra, and networking concepts.

Uploaded by

Munch Gehlout
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
165 views12 pages

Sample Paper

This document contains sample questions from a Computer Science exam for Class 12 in India. It includes questions on C++ concepts like typedef, #define, header files, errors in code, and output of code snippets. It also has questions on classes and objects, file handling, SQL queries, Boolean algebra, and networking concepts.

Uploaded by

Munch Gehlout
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

http://www.cbseguess.

com/

CBSE Sample Paper 2013 Computer Science C++ Class XII


Time 3hrs Q1. A) Write short notes on typedef and #define. Q1B) Give the Header files to run the following code. void main() { cout<<Click 2 Win; cout<<setw(9)<<hello; } Q1.C Find the Errors in the following program code and rewrite the correct code. Include<iostream.h> class bank { int acno; char nm[20]; float balamt; void bank() { } void input() www.cbseguess.com Other Educational Portals www.icseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com | www.niosguess.com | www.iitguess.com 2 M.M 70 2 1

http://www.cbseguess.com/

{ cout<<Enter the acno ; cin>>acno; } } void Main() { bank b; input.b(); } Q1d) Find the output of the following program: #include<iostream.h> void main() { int X[]={30,35,50,66,110}; int *p=X; while(*p<110) { if(*p%3!=0) *p=*p+1; else *p=*p+2; p++; www.cbseguess.com Other Educational Portals www.icseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com | www.niosguess.com | www.iitguess.com 3

http://www.cbseguess.com/

} for(int I=4;I>=1;i--) { cout<<X[I]<<*; if(I%3==0) cout<<endl; } cout<<X[0]*3<<endl; } Q1e) Find the output of the following program #include<iostream.h> #include <ctype.h> void CangeIt (char Text[], char C) { for (int K=0;Text [K]!='\0' ;K++) { if (Text[K] >='F' && Text[K] <='L') Text[K]=tolower(Text[K]); else if (Text[K]=='E' || Text[K]=='e') Text[K]=C; else if (K%2==0) Text[K]=toupper(Text[K]); else Text[K]=Text[K-1]; } } void main( ) { www.cbseguess.com Other Educational Portals www.icseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com | www.niosguess.com | www.iitguess.com 2

http://www.cbseguess.com/

char oldText[ ]= "Click@CAreeR2013" ; ChangeIt (oldText,'%'); cout <<"New TEXT:"<<oldText<<endl; } f) The following code is from a game .which generates a set of 4random numbers :identify the correct option(s)out of the four choices given below as the possible set of such numbers generated from the program code so that he wins the game. Justify your answer. 2 #include <iostream.h> #include <stdio.h> const int LOW = 15 ; void main( ) { randomize( ) ; int POINT =5, Number ; for (int I = 1 ; I <= 4 ; I ++) { Number = LOW + random(POINT) ; cout << Number << : ; POINT-- ; } } i) 19:16:15:18: (ii) 14:18: 15:16: (iii) 19:16:14:18: (iv) 19:16:15:16 Q2a) What is static Data member Explain with an eg. 2 Q2b) (b) Answer the questions (i) and (ii) after going through the following class : 2 class TEST { int Regno, Max, Min, Score ; www.cbseguess.com Other Educational Portals www.icseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com | www.niosguess.com | www.iitguess.com

http://www.cbseguess.com/

public : TEST( ) //Function 1 Regno = 101 ; Max=100; Min = 40 ; score = 75 ; } TEST(int Pregno, int Pscore) { Regno = Pregno ; Max = 100 ; Min = 40 ; Score = Pscore ; } ~TEST( ) { cout << TEST Over << endl ; } void Display( ) { cout << Regno << : <<Max<< : << Min << endl ; cout << *Score+ << Score << endl; } }; (i) What type of function 4 is and how it will be invoked //Function 4 //Function 3 //Function 2

(ii) What is Function 3 specifically referred as ? When do you think, Function 3 will be invoked/called?

www.cbseguess.com Other Educational Portals www.icseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com | www.niosguess.com | www.iitguess.com

http://www.cbseguess.com/

2c) Define a class Restra in C++ with following description: Private Members FoodCode of type int Food of type string Ftype of type string Sticker of type string A member function Getsticker to assign the following values for Sticker as per the given Ftype:

Ftype Sticker Vegetarian green Contains egg yellow Nonvegetarian red Public members A function GetFood() to allow the user to enter the values for Foodcode, food,ftype and call Function GetSticker() to assign Sticker. A function ShowFood() to allow the users to view the contents of all the data members. Q2(d) Answer the questions (i) to (iv) based on the following : class Chairperson { long CID ; char CName[20] ; protected : char Description[40] ; void Allocate( ) ; public : Chairperson( ) ; void Assign( ) ; void Show( ) ; }; class Director { www.cbseguess.com Other Educational Portals www.icseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com | www.niosguess.com | www.iitguess.com //Chairperson Identification Number 4

http://www.cbseguess.com/

int DID ; char Dname[20] ; protected : char Profile[30] ; public :

//Director ID

Director( ) ; void Input( ) ; void output( ) ; }; class Company : private Chairperson, public Director { int CID ; //Company ID

char City[20] , Country[20] ; public : Company( ) ; void Enter( ) ; void Display( ) ; }; (i) Which type of Inheritance out of the following is specifically is illustrated in the above C++ code ? (a) Single Level Inheritance (c) Multiple Inheritance (ii) Write the names of members, which are accessible by objects of class type Company. (iii) Write the name of all the member functions, which are accessible by objects of class type Company. (iv) Write the names of all members, which are accessible from member functions of class Director. (b) Multi Level Inheritance

www.cbseguess.com Other Educational Portals www.icseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com | www.niosguess.com | www.iitguess.com

http://www.cbseguess.com/

3(a)Write a function SWAP2BEST (int ARR[], int Size) in C++ to modify the content of the array in such a way that the elements, which are multiples of 10 swap with the value present in the very next position in the array. 3 For example : If the content of array ARR is 80, 66, 45, 20, 44, 54 The content of array ARR should become 56, 80, 45, 44, 20, 54 (b)An array T[20][10] is stored in the memory along the column with each of the elements occupying 2 bytes. Find out the memory location of T[10l[15], if the element T[3][9] is stored at the location 7800. 3 (C )Write a function in C++ to perform Insert operation in a static circular Queue containing Books information (represented with the help of an array of structure BOOK). 4 Struct BOOK { int bookno; char Title[20]; }; d) Write a function CHANGE( ) in C++, which accepts a 2d array of integer and its size as parameters and divide all those array elements by 7 which are not in the range 70 to 700 and find the square root of all other elements. 2 e) evaluate the following postfix expression 2,3,^,4,5,-,6,*,/ Q4a write a statement using seekg,tellg, seekp, tellp to set the position of reading object after the 5th object of the class BANK. Write the second statement to find the byte position after writing the 5th object. 1 Q4b Write a udf in c++ to find the count the middle character of the words in text file MYDATA.txt Having value D or d. 2 2

Q4c.Write a function in C++ to search for a laptop from a binary file LAPTOP.DAT containing the objects of class LAPTOP (as defined below). The program will display the records having RAM >2gb. 2 class LAPTOP { www.cbseguess.com Other Educational Portals www.icseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com | www.niosguess.com | www.iitguess.com

http://www.cbseguess.com/

long ModelNo; float RAM, HDD; char Details[120]; public: void StockEnter ( ) {cin>>Model No>>RAM>>HDD; gets(Details);} void StockDisplay( ){cout<<ModelNo<<RAM<<HDD<<Details<<endl;} float myLapTopRAM() return RAM}; };

Q5a) What is cardinality and degree explain with an eg. Q5b)

Consider the following tables WORKER and PAYLEVEL and answer (b) and (c) parts of this question: Table: WORKER ECODE 11 12 13 15 18 NAME DESIG PLEVEL DOJ P001 P003 P003 P002 DOB 13-Sep-2004 22-Feb-2010 14-Jun-2009 21-Aug-2006 23-Aug-1981 12-Jul-1987 14-Oct-1983 13-Mar-1984

Radhey Shyam Supervis Chander Nath Fizza Operator Operator

Ameen Ahmed Mechanic Sanya Clerk P002

19-Dec-2005

09-Jun-1983

Table: PAYLEVEL PLEVEL PAY ALLOWANCE P001 P002 26000 12000 22000 10000

www.cbseguess.com Other Educational Portals www.icseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com | www.niosguess.com | www.iitguess.com

http://www.cbseguess.com/

P003

12000 6000 6

(b)Write SQL commands for the following statements: (i) To display the details of all WORKERs, descending order of DOB. (ii) Write a command to delete the records of workers having name starts with F.

(iii)Write a command to modify the records of by adding their pay by 1000 having allowance >10000. (iv) To add a new row with the following : 19 Kishore, Operator, P003. 19-Jun-2008, 11-Jul-1984 v) write a command to display the name, designation of workers having pay+allowance <30000 vi) write a command to delete all the records of worker table with all its contents and structure. (c)Give the output of the following SQL queries : (i) SELECT COUNT (PLEVEL), PLEVEL FROM WORKER GROUP BY PLEVEL; (ii) SELECT MAX(DOB), MIN(DOJ) FROM WORKER; (iii) SELECT Name, Pay FROM WORKER W, PAYLEVEL P WHERE W.PLEVEL = S.PLEVEL AND P.ECODE<13; (iv) SELECT PLEVEL, PAY+ALLOWANCE FROM PAYLEVEL WHERE PLEVEL = P003; 6.(a) State and Verify Absorption law algebraically. (b) Draw the circuit using nand gates only a.b+bc+cd (c) Write the POS form of a Boolean function F, which is represented in a truth table as follows: A B C 0 0 0 0 0 1 0 1 0 F 1 1 1 1 2 2 2

www.cbseguess.com Other Educational Portals www.icseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com | www.niosguess.com | www.iitguess.com

http://www.cbseguess.com/

0 1 1 1 1

1 0 0 1 1

1 0 1 0 1

0 1 0 0 1 3

(d) Reduce the following Boolean Expression using K-Map : F(M, N, O, P) = (0, 1,2,3, 4, 5, 6, 8, 12,15) 7.(a) What is bandwidth and baud. (b)Differentiate between client and server script (c) What is CDMA ? d) give any 2 examples of hacking for fun 1 1 1 1

(e) Quick Learn University is setting up its Academic blocks at Prayag Nagar and planning to set up a network. The university has 3 academic blocks and one Human Resource Center : 4 center to center distances between various block/center is as follows : Law Block to Business Block Law Block to Technology Block Law Block to HR Center Business Block to Technology Block Business Block to HR Center Technology Block to HR Center 40 m 80 m 105 m 30 m 35 m 15 m

Number of Computers in each of the Blocks / Center is follows : Law Block Technology Block 15 40

www.cbseguess.com Other Educational Portals www.icseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com | www.niosguess.com | www.iitguess.com

http://www.cbseguess.com/

HR Center Business Block

115 25

(e1) Suggest the most suitable place (i.e. Block / Center) to install the server of this university with a suitable reason. (e2) Suggest an ideal layout for connecting these blocks/center for a wired connectivity. (e3) Which device you will suggest to be placed/ installed in each of these blocks/center to efficiently connect all the computers with in these blocks / center. (e4) The university is planning to connect its admission office in the closest big city, which type of network out of LAN, MAN or WAN will be formed? Justify your answer.

For Any Queries or Answers Contact

Test paper By: Sujeet Varshney Director Click @ Career Author C++ CBSE Question Bank 16 Years of Experience in C++ XI-XII Computer Science Classes 9810736739,9990709612

www.cbseguess.com Other Educational Portals www.icseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com | www.niosguess.com | www.iitguess.com

You might also like