Formatting page ...
Sample Paper 2017 Sub.- Compute Science [C++] Class- XII MM.- 70 Time- 3Hrs. Q1. What is Encapsulation? 1 Q2. What are Static Member variables. 1 Q3. What are Hacker and Crackers? 2 Q4. Which C++ header file(s) are essentially required to be included to run/execute the following C++ code : 2 void main() { char *word1="Hello",*word2="Friends"; strcat(word1,word2); puts(word1); } Q5. Rewrite the following program after removing any syntactical errors. Underline each correction made. 2 #include<stream.h> void Main( ) int A[10]; A=[3,2,5,4,7,9,10]; for( p = 0; p<=6; p++) { if(A[p]%2=0) int S = S+A[p]; } cout<<S; } Q6. Rewrite the following program after removing the syntactical errors (if any). Underline each correction. 2 #include<conio.h> #include<iostream.h> #include<string.h> #include<stdio.h> class product { int product_code,qty,price; char name[20]; public: product(){ product_code=0;qty=0;price=0; name=NULL; } void entry() { cout<<"\n Enter code,qty,price"; cin>>product_code>>qty>>price; gets(name); } void tot_price() {return qty*price;} }; void main() { p product; p.entry(); cout<<tot_price(); } Q7. Write the output of the following C++ program code:Note: Assume all required header files are already being included in the program. 2 void change(int *s) { for(int i=0;i<4;i++) { if(*s<40) { if(*s%2==0) *s=*s+10; else *s=*s+11; } else { if(*s%2==0) *s=*s-10; else *s=*s-11; } cout<<*s<<" "; s++; } } void main() { int score[]={25,60,35,53}; change(score); } Q8. Observe the following program carefully and attempt the given questions: 2 #include<iostream.h> #include<conio.h> #include<stdlib.h> void main() { clrscr(); randomize(); char courses[][10]={"BCA","MCA","MBA","BBA"}; int ch; for(int i=1;i<=3;i++) { ch=random(i)+1; cout<<courses[ch]<<"\t"; } getch(); } I. Out of all the four courses stored in the variable courses, which course will never be displayed in the output and which course will always be displayed at first in the output? II. Mention the minimum and the maximum value assigned to the variable ch? Q9. Answer the questions(i) and (ii) after going through the following class: 2 class Moon { char name[20];char distance[20]; public: Moon() //Function 1 { strcpy(name, "Venus"); strcpy(distance,"38 million km"); } void display(char na[],char d[]) //Function 2 { cout<<na<<"has "<<d<<" distance from Earth"<<endl; } Moon(char na[], char d[]) //Function 3 { strcpy(name,na); strcpy(distance,d); } ~Moon() //Function 4 { cout<<"Time is Over!!!"<<endl; } }; I. What is Function 1 referred as? When will it be executed? II. Write suitable C++ statement to invoke Function 2. Q10. Write a function RevText() to read a text file Input.txt and Print only word starting with I in reverse order . 2 Example: If value in text file is: INDIA IS MY COUNTRY Output will be: AIDNI SI. Q11. Write a function display () in C++ to display all the students who have got a distinction(scored percentage more than or equal to 75) from a binary file stud.dat , assuming the binary file is containing the objects of the following class: 2 class student { int rno; char sname [20]; int percent; public: int retpercent() { return percent; } void getdetails() { cin>>rno; gets(sname); cin>>percent; } void showdetails() { cout<<rno; puts(sname); cout<<percent; } }; Q12. Correct the following Boolean statements: 2 1. X+1 = X 2. (A')'=A' 3. A+A'=0 4. (A+B)' = A.B Q13. Draw the equivalent logic circuit for the following Boolean expression: (A.B)+C 2 Q14. Evaluate the following POSTFIX expression. Show the status of Stack after execution of each operation separately: 2 45, 45, +, 32, 20, 10, /, -,* Q15. Write the POS form of a Boolean Function F, which is represented in a truth table as follows: 2 P Q R F 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 Q16. Identify the type of topology on the basis of the following: 3 A. Since every node is directly connected to the server, a large amount of cable is needed which increases the installation cost of the network. B. It has a single common data path connecting all the nodes. C. Daniel has to share the data among various computers of his two offices branches situated in the same city. Name the network (out of LAN, WAN, PAN and MAN) which is being formed in this process. Q17. Write a function to sort any array of n elements using insertion sort. Array should be passed as argument to the function. 3 Q18. Write the definition of a function grace_score (int score [], int size) in C++, which should check all the elements of the array and give an increase of 5 to those scores which are less than 40. 3 Example: if an array of seven integers is as follows: 45, 35, 85, 80, 33, 27, 90 After executing the function, the array content should be changed as follows: 45, 40, 85, 80, 38, 32, 90 Q19. Write the definition of a member function push() for a class Library in C++ to insert a book information in a dynamically allocated stack of books considering the following code is already written as a part of the program: 3 struct book { int bookid; char bookname[20]; book *next; }; class Library { book *top; public: Library() { top=NULL; } void push(); void pop(); void disp(); ~Library(); }; Q20. Write a user-defined function swap_row(int ARR[ ][3],int R,int C) in C++ to swap the first row values with the last row values: 3 For example if the content of the array is: 10 20 30 40 50 60 70 80 90 Then after function call, the content of the array should be: 70 80 90 40 50 60 10 20 30 Q21. Write a user defined function word_count() in C++ to count how many words are present in a text file named opinion.txt . For example, if the file opinion.txt contains following text: 3 Co-education system is necessary for a balanced society. With co-education system, Girls and Boys may develop a feeling of mutual respect towards each other. The function should display the following: Total number of words present in the text file are: 24 Q22. Consider the following unsorted list : 95 79 19 43 52 3. Write the passes of bubble sort for sorting the list in ascending order till the 3rd iteration. 3 Q23. Rajan Medicos Center has set up its new center in Dubai. It has four buildings as shown in the diagram given below: 4 Distances between various buildings are as follows: Accounts to Research Lab Accounts to Store Store to Packaging Unit Packaging Unit to Research Lab Accounts to Packaging Unit Store to Research Lab 55m 150m 160m 60m 125m 180m Number of Computers Accounts 25 Research Lab 100 Store 15 Packaging Unit 60 As a network expert, provide the best possible answer for the following queries: i) Suggest a cable layout of connections between the buildings. ii) Suggest the most suitable place (i.e. buildings) to house the server of this organization. iii) Suggest the placement of the following device with justification: a) Repeater b) Hub/Switch iv) Suggest a system (hardware/software) to prevent unauthorized access to or from the network. Q24. Define a class Hotel in C++ with following description: 4 Private Members RoomNo of type int Name of type char RoomCategory of type char Charge of type float A member function chkchg( ) to assign the value of charge variable according to the style entered by the user according to the criteria as given below: Category Charge Sweet 10000 Deluxe 8000 Special 11000 Public Members A function Room() to allow users to enter values for RoomNo,Name, Category and call function chkChg()to assign value of charge variable according to the category entered by the user. A function display() to allow users to view the details of all the data members. Q25. Answer the questions (i) to (iv) based on the following: 4 class indoor_sports { int i_id; char i_name[20]; char i_coach[20]; protected: int i_rank,i_fee; void get_ifee(); public: indoor_sports(); void iEntry(); void ishow(); }; class outdoor_sports { int o_id; char o_name[20]; char o_coach[20]; protected: int orank,ofee; void get_ofee(); public: outdoor_sports(); void oEntry(); void oshow(); }; class sports:public indoor_sports,protected outdoor_sports { char rules[20]; public: sports(); void registration(); void showdata(); }; Q26. Write SQL commands for the queries (i) to (iv) and output for (v) to (viii) based on the tables Watches and Sale given below: 9 Watches Watchid W001 W002 W003 W004 W005 Sale Watch_Name HighTime LifeTime Wave HighFashion GoldenTime Price 10000 15000 20000 7000 25000 Type Unisex Ladies Gents Unisex Gents Qty_Store 100 150 200 250 100 Watchid Qty_Sold Quarter W001 10 1 W003 5 1 W002 20 2 W003 10 2 W001 15 3 W002 20 3 W005 10 3 W003 15 4 i. To display all the details of those watches whose name ends with Time ii. To display watch s name and price of those watches which have price range in between 5000-15000. iii. To display total quantity in store of Unisex type watches. iv. To display watch name and their quantity sold in first quarter. v. Select max(price), min(qty_store) from watches; vi. Select quarter, sum(qty_sold) from sale group by quarter; vii. Select watch_name,price,type from watches w, sale s where w.watchid!=s.watchid; viii. Select watch_name, qty_store, sum(qty_sold), qty_storesum(qty_sold) Stock from watches w, sale s where w.watchid=s.watchid group by s.watchid; ix. What is the cardinality and degree of SALE table.
|