Sei sulla pagina 1di 8

1

IF YOU LIKE THE MATERIAL TO BE USEFUL THEN


PLEASE GIVE FEED BACK AT
SM_MANDA@YAHOO.COM

Half Yearly Examination 2009


Subject : Computer Science Class :Class XI
Time Allowed : 3 hours Maximum Marks: 70
General Instructions:
(i) All questions are compulsory.
(ii) Programming Language: C++
1. (a) What do you mean by abstraction and encapsulation? How
are these two terms interrelated? 2
(b) Name the other header files that shall be needed for the
following code: 1
#include <iostream>
using namespace std;
int main()
{
char ch='b';
int x=45;
x = log10(x);
cout<<ch<<setw(15)<<"HEllo";
return 0;
}
(c) Rewrite the following program after removing the
syntactical errors(if any). Underline each correction. 2
#include <iostream>
using namespace std;

int main()
{
char ch='b';
int x=45;
2

if x>30
x--;
for(;;) break;
cout>>"Hello";
while (6) break;
cin>>ch;
++x--;
ch=c;
return 0;
}
(d) Find the output of the following C++ program. 3
#include <iostream>
using namespace std;
int main()
{
int x=45;
for(;x>20;x+=4)
{
if(x%5==0)
cout<<x<<endl;
else
continue;
if(!(x%7))
break;
}
cout<<x<<endl;
return 0;
}
(e) In the following program, find the correct possible
output(s) from the optons: 2
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int y=0;
3

while(y<=10)
{
int x =1;
do{
x++;
if(y%x==0) cout<<"*";
if(x%3==2) cout<<"#";
}while(x<3);
y+=6;
cout<<"%";
}
return 0;
}
(i) #%#%
(ii) *#*%*#*%
(iii) **%**%
(iv) **#%**#%
(f) Find the output of the following C++ program. 2
int main(){
int y=0;
for(int x=50;x>20;x-=5) {
switch(x) {
case 20:
y=y+x;
break;
case 25:
y = y +5;
break;
case 30:
y = y+10;
break;
case 35:
y =y+x;
case 40:
y =y+3;
x=x-5;
break;
case 45:
4

y=y+2;
break;
case 50:
x =x-5;
default:
x=x-5;
}
cout<<(x+y)<<endl;
}
return 0;
}
2 (a) The size of storage devices BD and CD is same but
capacity differs. Why? 2
35
(b) Convert (i) 2MB to Bytes (ii) 3.5X2 Byte to GB 2
(c) Convert following numbers. 4
(i) 725.250 decimal number into binary number
(ii) 111011.00101 binary number into decimal number
(iii) 1FF.1A Hexadecimal number into decimal number
(iv) -177 into 2’s complement number in 8 bit format
(d) Explain UNICODE and ASCII code. 2
(e) Write short note on Flash memories with one example.2
3. (a) Define (i) Time sharing operating system (ii) Real time
operating systems (iii) BOSS 3
(b) Write a C++ program that takes 3 numbers as input,
arrange them in ascending order and display back to user.
For example if input is 6 8 3 then output should be 3 6 8. 3
(c) Write a C++ program that take a year as input print
whether the year is leap year or not. 2
(d) Write the C++ program using loop to print the following
pattern. One statement should print one character at
time. 2
*****#
****#
***#
**#
*#
5

#
(e) Write a C++ program that takes a number as input and
print reverse of that number. For example if input is 4523
then output will be 3254. 3
(f) Declare following variables. 3
(i) An Integer constant (ii) A double constant
(iii) A reference variable to float (iv) A pointer to character
(v) An integer array of 10 items (vi) An unsigned integer

4. (a) Explain types of errors with one example of each. 4


(b) Give some stylistic guidelines for good program. 3
(c) Define Inheritance and Polymorphism. 2
(d) Define Lexical unit in C++. 1

5. (a) Write “Valid” if the following C++ identifiers are valid else
write “Invalid”. 3
(i) register (ii) class1 (iii) _34Name
(iv) Emp-name (v) one_to_two (vi) break3
(b) Write equivalent C++ statement for following mathematics
statements. 2
5x + 3 y
(iii) |sin2(Ø) – cos2(Ø)| (iv) (a2+b2)
3
(i) a b + ba (ii) 5
5x − 3 y
(c) What is the effects of comments on complier. 1
(d) Explain the purpose of insertion and extraction operators
in C++. 2

6. (a) What is the difference between pointers and reference


variables? Explain with the help of examples. 2
(b) Write C++ program to calculate area of a triangle. Take
the required parameters as input from user. Area of
triangle = s(s - a)(s - b)(s - c) where s=(a+b+c)/2 and a, b and c
are side of triangle. 2
(c) What is difference among structure, array and class? 3

7. (a) Write a C++ program that takes two numbers as input and
print all the even number between these numbers and
their sum. 2
6

(b)
Write a C++ program to print a menu and calculate area,
perimeter and diagonal of a rectangle based on user
choice. 3
This paper contains 7 question and 5 printed pages

Scoring Key
Q.No Answer Hint
1.(a) (i) abstraction—1 Mark (ii)encapsulation—1 Mark
(b) Two header files—math.h—1/2 mark and iomanip.h—1/2 mark
(c) 4 errors X ½ = 2 marks
(d) Processing steps – 2 marks output--45 65 85 105 105—1 mark
(e) Processing –1 mark output--#%#%--1 marks
(f) Processing—1 mark 48 68 68—1 mark
2.(a) Two difference- 1marks for one difference
(b) 2 conversion—2 marks one for each conversion
(c) 4 conversion—4X1=4 marks one for each conversion
(d) UNICODE—1 marks, ASCII—1 mark
(e) Explaination—1mark, example—1 mark
3.(a) Three operating system—3 marks one for each operating systems.
(b) Structure— ½ mark, Indentation— ½ mark, logic-2 marks
(c) Structure— ½ mark, Indentation— ½ mark, logic-1 marks
(d) Structure— ½ mark, Indentation— ½ mark, logic-1 marks
(e) Structure— ½ mark, Indentation— ½ mark, logic-2 marks
(f) 6 declaration X ½ = 3 marks
4.(a) Name of errors –1 mark, Explanations—2 marks, example—1 mark
(b) Three points X1 mark—3 marks
(c) Inheritance –1 mark, Polymorphism—1 mark
(d) Definition –1 mark
5.(a) 6 declaration X ½ mark—3 marks
(b) 4 statements X ½ mark—2 marks
(c) One effect—1 mark
(d) Insertion—1 mark, extraction—1 mark
6.(a) Difference—1mark, example—1mark
(b) Structure— ½ mark, Indentation— ½ mark, logic-2 marks
(c) Structure—1mark, array—1mark and class—1mark
7.(a) Structure— ½ mark, Indentation— ½ mark, logic-1 marks
7

(b) Structure— ½ mark, Indentation— ½ mark, logic-2 marks


8

VSA SA LA Total
Chapter No. No. No. No.
M. M. M.
of Total of Total of Total of Total
M. M. M.
Ques. Ques. Ques. Ques.
Computer
2 1 2 2 2
Overview
Working with
operating 3 1 3 3 3
system
Data
6 1 6 6 6
representation
Input, output
and Memory 2 2 4 2 4
Devices
General
Object
2 2 4 2 4
oriented
concepts
Getting
started with 2 1 2 1 2 2 3 4
C++
Data handling 6 1 6 1 3 3 7 9
Operators and
expressions in 3 1 3 2 2 4 5 7
C++
Flow of
6 2 12 4 3 12 10 24
Control
Programming
1 3 3 1 4 4 2 7
Methodology
Total 32 - 42 8 - 21 2 - 7 42 70

Potrebbero piacerti anche