Question Papers

Revision  Question Paper:

CLASS XII  COMPUTER SCIENCE :  Answers to be submitted in the homework book only. Index it as holiday homework -Holiday June. 

1.a)What is the difference between call by reference & call by value method in a user defined function in C++? Explain it with suitable example. 
b) Name the header file to which the following belong : 
(i) gotoxy( ) (ii) gets() 
c) Rewrite the following program after removing all the syntactical errors (if any), underlining each correction. 
include<iostream.h> 
typedef char[40] string; 
void main( ) 
{ string S=”Australia”; 
L=strlen(S); 
cout<<”String “<<S<<’ has ’<<L<<”Characters”<<endl; } 
d) Find the output of the following program: 
#include <iostream.h> 
#include<conio.h> 
void main() 
{ 
int X[ ]={10,25,30,55,110}; 
int *p= X; 
while(*p<110) 
{ 
if(*p%3) 
*p=*p+1; 
else 
*p=*p+2; 
p++; 
} 
for( int i=4;i>=1;i--) 
{ 
cout<<X[i]<<”*”; 
if(i%3==0) 
cout<<endl; 
} 
cout<< X[0]*3<<endl; 
} 
e) Define a class TAXPAYER in C++ with following description : 
Private members : 
a. Name of type string 
b. PanNo of type string 
c. Taxabincm (Taxable income) of type float 
d. TotTax of type double 
e. A function CompTax( ) to calculate tax according to the following slab: 
Taxable Income   Tax% 
Up to 160000                 0 
>160000 and <=300000   5 
>300000 and <=500000      10 
>500000              15 
Public members : 
•A parameterized constructor to initialize all the members 
•A function INTAX( ) to enter data for the tax payer and call function CompTax( ) to assign TotTax. 
• A function OUTAX( ) to allow user to view the content of all the data members. 

SEARCH & LEARN State and verify Absorption law in Boolean algebra. 

2 a)When a function is overloaded, there are multiple definitions of the functions. What makes the various definitions of the function different from each other? 
(b) Which C++ header file(s) will be essentially required to run/execute the following C++ code? 
void main() 
{ 
int Rno=465; 
char SName[]= “Ajay Bhaskar”; 
cout<<setw(6) <<Rno<<setw(25)<<SName<<endl; 
} 
(c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. 
#include<iostream.h> 
struct Screen 
{ int C, R;} 
void ShowPoint(Screen P) 
{ cout<<P.C, P.R<<endl; 
} 
void main() 
{
Screen Point1 = (5, 3); 
ShowPoint(Point1); 
Screen Point2= point1; 
C.Point1+= 2; 
Point1.R = Point1.R + 2; 
} 
d) Find the output of the following program: 
#include<iostream.h> 
void ChangetheContent(int Arr[], int Count) 
{ 
for(int C=0; C<Count; C++) 
Arr[C]= Arr[Count – C-1]; 
} 
void main() 
{  int A[]= {1, 2, 3}, B[] = {20, 30, 40, 50}, C[]= {100, 200}; 
ChangetheContent(A,3); 
ChangetheContent(B,4); 
ChangetheContent(C,2); 
for(int L=0; L<3; L++) cout<<A[L]<<’#’; 
cout<<endl; 
for(int L=0; L<4; L++) cout<<B[L]<<’#’; 
cout<<endl; 
for(int L=0; L<2; L++) cout<<C[L]<<’#’; 
cout<<endl; 
} 
(e) Give the output of the following program (Assuming that all required header files are included in the program
void main() 
{ 
char a[]= “Exam-2011 AheAd”; 
int i; 
for(i=0; a[i]!= ‘\0’;i++) 
{ 
if(a[i]>= 97 && a[i]<=122) 
a[i] --; 
else 
if(a[i]>= ‘0’ && a[i]<= ‘9’) 
a[i] = a[i -1]; 
else 
if(a[i]>= ‘A’ && a[i]<= ‘Z’) 
a[i]+ = 32; 
else 
a[i]= ‘#’; 
} 
puts(a); 
} 
(f) Study the following program and select the possible output from it: 
#include<iostream.h> 
#include<stdlib.h> 
const int LIMIT = 4; 
void main() 
{ 
randomize(); 
int Points; 
Points= 100 + random(LIMIT); 
for(int P=Points; P>=100; P--) 
cout<<P<<’#’; 
cout<<endl; 
} 
(i) 103#102#101#100# (ii) 100#101#102#103# (iii)104#103#102#101# (iv) 103#102#101#100 
g)Define a class Sports in C++ with following descriptions: 
Private members: 
S_Code of type long 
S_Name of type character array (String) 
Fees of type integer 
Duration of type integer 
Public members: 
Constructor to assign initial values of S_Code as 1001, S_Name as “Cricket”, Fees as 500, Duration 70 
A function NewSports() which allows user to enter S_Code, S_Name and Duration. Also assign the values to Fees as per the following conditions: 
S_Name Fees 
Table Tennis 2000 
Swimming 4000 
Football 3000 
A function DisplaySports() to display all the details. 

SEARCH & LEARN Verify X’.Y+X.Y’=(X’+Y’).(X+Y) algebraically. 
3) a )Write the names of the header files which are necessary to execute the following C++ code 
void main() 
{ char c, String[ ] = " System Design "; 
for(int i=0; String[i]!='\0' ;i++) 
if(String[i]= = ' ') 
cout<<endl; 
else 
{c=toupper(String[i]); 
cout<<c; 
}} 
(b)Rewrite the following program after removing the syntactical error(s),if any .Under line each correction . 
#include<iostream.h> 
#include<stdio.h> 
void main() 
{ struct emp 
{ 
char emp_name[15]; 
char emp_no; 
int salary = 5000; 
}EMPLOYEE; 
gets(emp_name); 
gets(emp_no); 
} 
(c) Find the output of the following program
#include<iostrem.h> 
#include<ctype.h> 
void main() 
{ 
char Text[ ] = “Mind@Work!”; 2 
for(int i=0 ; Text[i]!=’\0’ ; i++) 
{ 
if(!isalpha(Text[i])) 
Text[i]= ‘*’; 
else if (isupper(Text[i])) 
Text[ i]=Text[i]+1; 
else 
Text[i]=Text[i+1]; 
} 
cout<<Text; 
} 
(d) Give the output of the following program 
#include<iostream.h> 
int global = 10; 
void func(int &x, int y) 
{x =x-y; y= x * 10; 
cout<< x <<' , ' << y << "\n"; 
} 
void main() 
{ int global = 7; 
func(:: global, global); 
cout<<global<<' , '<<::global<<"\n"; 
func(global, ::global); 
cout<<global<<' , '<<::global<<"\n"; 
} 
(e). Find the correct possible out put(s)
#include<stdlib.h> 
#include<iostream.h> 
void main() 
{randomize(); 
char city[ ]={“PKD”, “EKM”, ”TVM”, “KOL”, “CAL”}; 
int ZEN; 
for(int i=0;i<3;i++); 
{ZEN=random(2)+1; 
cout<<city[ZEN]<<”@”; 
} 
} 
(i) PKD@ EKM @TVM@                        (ii) EKM @TVM@ EKM @ 
(iii) TVM@KOL@CAL@                         (iv) TVM@ EKM @TVM@ 
f) Define a class BOOK with the following specifications. 
Private members 
BOOK_NO integer type 
BOOK_TITLE 20 Characters 
PRICE float(price per copy) 
TOTAL_COST() A function to calculate the total cost for N number of copies, 
Where N is passed to the function as argument 
Public members 
INPUT() Function to read BOO_NO, BOOK_TITLE, PRICE , PURCHASE() Function to ask the user to input the number of copies to be purchased. It invokes TOTAL_COST() and prints the total 
cost to be paid by the user.  Note: You are also required to give detailed function definitions. 

Question paper No-2

Area: Fundamentals of C++

Marks: 25
Submission: as an attachment of word file in email id set already in the form sol_qp2_<studentname>

Do include your name in the word file and date of attempting the question

1. What are data types?
2. In what categories data types are divided?
3. Define a variable
4. Differentiate between declaration, definition and initialization of a variable.
5. Define a constant
6. Differentiate between 1, ‘1’, “1”
7. Give examples of integer,float,character and string constant
8. Why is char often treated as integers?
9. Can integer value be stored in float variables and vice versa?
10. Can  char be stored in int variables and vice versa?
11. What is #include called and why?
12. What are various types of  operators
13. Differentiate between unary, binary and ternary operator
14. How is postfix operator different from prefix? Which has higher priority?
15. Give the priority of all operators?
16. What is the difference between = and = = ?
17. Differentiate between simple and compound statements.
18. What are  put in and get from operators?
19. Differentiate between syntax,logical and runtime errors.
20. What is the difference between keyword and identifier?

Last date of submission: 07-11-2012 by 9:00 pm (mail reaches by 9:00 pm)



Question paper .1

Area: Programming
Marks: 25
Marking: clarity, variable naming, proper logic, output, complexity.

Method: Submit using a word file the entire paper by e-mailing with a subject 
solution_qp1_<name of the student> to id mentioned earlier

1. Name the various types of operators used in C++.
2. Write a program to stimulate the Fibonacci series.
3. Write a program to print the prime numbers between given two numbers.
4. Write a program to take a string and to calculate its rank using if-else.
5. Write a program to assign a grade to its obtained percentage marks for n number of students.

0 comments :

Back to top ↑
Connect with Us

    Total Pageviews

    Powered by Blogger.

    Followers

    Blogroll

What they says

© 2013 The Programming Trailblazers . WP Mythemeshop Converted by Bloggertheme9
Blogger templates . Proudly Powered by Blogger .