Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Class Xi Cs Annual Exam 17 18

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

KENDRIYA VIDYALAYA SANGATHAN, VARANASI REGION

SESSION ENDING EXAMINATION-2018


CLASS : XI MAX. MARKS: 70
SUBJECT: COMPUTER SCIENCE (CODE-083) MAX. TIME: 3 HOURS

Instructions :
1. All questions are compulsory.
2. Answer the questions after carefully reading the text.
3. Programming Language is C++.

1. (a) Write any two Strengths of a Computer. 1 Mark


(b) Differentiate between Volatile and Non-volatile Memory. 2 Marks
(c) What is Cache memory? 1 Mark
(d) Differentiate between Compiler and Interpreter. 2 Marks
(e) Write down ant two functions of Operating System. 1 Mark
(f) (i) Convert 22.2510 to Binary. 2 Marks
(ii) Convert B2F16 to Octal.
(g) What is UNICODE? 1 Mark

2. (a) What is the difference between 0 and ‘0’ in C++? 1 Mark


(b) What is the function of Logical operators? Write an expression involving a 2 Marks
logical operator to test if mark is greater than or equal to 55 and grade is ‘B’.
(c) Write a C++ program to convert and display a given number of days into years, 3 Marks
weeks and days. (1 year = 365 days, 1 Week = 7 days)
For e.g. 380 days = 1 Year 2 Weeks and 1 day
(d) Consider the following two C++ statements. Are they equivalent? Explain. 1 Mark
char grade = 66;
char grade = ‘B’;
3 (a) What do you mean by Implicit and Explicit Type Conversion? Explain with 2 Marks
suitable examples.
(b) Evaluate the following C++ expression where A, B, C are integers and D is 1 Mark
floating point number. The value of A=5, B=3 and D=1.5
C = (A++) * D + A;
(c) Write an equivalent C++ expressions for the following expressions: 2 Marks
2
(i) e ¿2 x −4 x∨¿¿ (ii) |a| + b >= |b|+a
(d) The following is illegal. Why? How would you correct it? 2 Marks
void main()
{
int i=j=k=0;
}

4. (a) Differentiate between Testing and Debugging. 2 Marks

(b) What is the role of Comments and Indentation in a program? 2 Marks

(c) What are the characteristics of a Good Program? Explain any three in brief. 3 Marks

(d) Why are Logical Errors harder to locate? 1 Mark

(e) Differentiate between Syntax errors and Semantics errors with suitable C++ 2 Marks
examples.
(f) What is the significance of Documentation? 1 Mark

(g) What do you mean by Program Maintenance? 1 Mark

5. (a) What is the problem of Dangling else? What is the default Dangling else 2 Marks
matching?

(b) Rewrite the following code fragments using switch: 2 Marks

char code;
cin>>code;
if(code==’A’)
cout<<”Accountant”;
else if(code==’C’ || code==’G’)
cout<<”Grade IV”;
else if(code==’F’)
cout<<”Financial Adviser”;

(c) Write a C++ program to check whether the given number is Palindrome or not. 3 Marks
A number that reads the same backward as forward.
For e.g. 12321 is a palindrome number as it reads the same from the forward as
well as from the backward
(d) What will be the output of the following code 1 Mark
fragment:
:
int a;
cin>>a;
if(a=5)
cout<<”Five”;
else
cout<<”Not Five”;
if the input given is (i)7 (ii) 5
(e) Differentiate between switch and if-else statements. 2 Marks

6. (a) What is the significance of function prototype? 1 Mark

(b) What are Actual and Formal Parameters of a function? Also, give a suitable C++ 2 Marks
code to illustrate both.

(c) Write a C++ program that uses a function PRIMECHECK(), that takes an int 4 Marks
argument and returns 0 if the given argument is prime otherwise it returns -1.
The program should display a suitable message “The number is prime” (if the
return value is 0) or “The number is not prime” (if the return value is -1)

(d) Give the output of the following program: 3 Marks

#include<iostream.h>
#include<conio.h>
void Execute(int &X, int Y=200)
{
int TEMP=X+Y;
X+=TEMP;
if(Y!=200)
cout<<TEMP<<" "<<X<<" "<<Y<<endl;
}
void main()
{
clrscr();
int A=50, B=20;
Execute(B);
cout<<A<<" "<<B<<endl;
Execute(A,B);
cout<<A<<" "<<B<<endl;
getch();
}

7.(a) Declare an array A of 5 integers and initialize it to the first five even numbers. 1 Marks

(b) Write a program to print the upper and lower triangle of matrix. 4 Marks
(a matrix is a 2-Dimensional array of size M X N)
If the 2-D array is
1 2 3
4 5 6
7 8 9
Then the upper and lower triangle are as follows:
1 2 3 1
5 6 4 5
9 7 8 9
(c) Write a program to count the number of occurrences of a given character in a 3 Marks
string.

(d) Declare a structure Student in C++ with name, roll number and total marks as 1 Mark
components.

(e) Rewrite the following program after removing the syntactical error(s), if any. 2 Marks
Underline each correction.
#include<iostream.h>
void main()
{
struct STUDENT
{ char stu_name[20];
char stu_sex;
int stu_age=17;
}student;
gets(stu_name);
gets(stu_sex);
}

(f) Give the output of the following program: 3 Marks

#include<iostream.h>
struct Package
{
int Length,Breadth,Height;
};
void Occupies(Package M)
{
cout<<M.Length<<”x”
<<M.Breadth<<”x” ; cout<<M.Height<<endl;
}
int main( )
{
Package P1={100,150,50},P2,P3;
++P1.Length;
Occupies(P1);
P3=P1;
++P3.Breadth;
P3.Breadth++;
Occupies(P3);
P2=P3;
P2.Breadth+=50;
P2.Height--;
Occupies(P2);
return 0;
}

************************

You might also like