FINAL EXAMINATION, 2018
Subject: Computer Science(Set B)
Marking Scheme
Class: XI Maximum Marks: 70
General Instructions:
- All the questions are compulsory.
- Write answers neatly and legibly.
Solution1
a)In spite of logical errors presence the program executes without any problems but the output produced
is not correct. Therefore each and every statement of the program needs to be scanned and interpreted. Thus the logical errors are harder to locate. 1
b) Syntax error refers to error resulting from violation of programming language rules
e.g., a*b=c is a syntax error.
Semantics errors occur when statements are not meaningful.2
c) SRAM (static RAM) is random access memory that retains data bits in its memoryas long as
power is being supplied. Unlike dynamic RAM, which stores bits in cells consisting of a capacitor and atransistor, SRAM does not have to be periodically refreshed. Static RAM provides faster accessto data and is more expensive than DRAM. SRAM is used for a computer'scache memoryand as part of therandom access 2
d) An Operating System is a program which acts as an interactive between a user and the hardware.
Its functions are: Program execution, Handling Input/Output Operations, Manipulation of file system,
Error detection and handling, Resource allocation etc.2
e)Open Source software refers to software whose source code is available to customers and it can be modified and redistributed without any limitation. An OSS may come free of cost or with a payment of nominal charges that its developers may change in the name of development, support of software.
Proprietary software is the software that is neither open not freely available. Its use is regulated and further distribution and modification is either forbidden or requires special permission by the supplier or vendor. Source code of proprietary software is normally not available. 2
Solution2
a) American Standard Code for Information Interchange.1
b)i. (AFC)16 to ( 101011111100)21
ii. (80)10 to ( 1010000)21
iii. (5432)8 to (B1A )161
Solution3
a)i. it is correct ii. escape sequence (‘\n’), can’t be used with cin½ + ½
b) i) = is an assignment operator and ==is a relational operator, used for comparison ½ + ½
c) i. Wrapping of data under a single unit is Data Encapsulation1
ii. Polymorphism is the ability for a message or data to be processed in more than one form.
The same operation is performed differently depending upon the data type it is working upon.1
d) i. Keyword are the words that convey a special meaning to the language compiler1
ii. The multiple use of input or output operator (> or <) in one statement is called Cascading.1
e) void main()2
{int length, feet, inches;
cout< “Enter length in inches: “;
cin>length;
feet=length/12;
inches = length%12;
cout< feet<” Feet and “<inches<” inches”;
}
f)Post fix follows use-then-change rule. The first use the value of their operand in evaluating the expression
and then change(increment or decrement) the operand’s value1
Pre fix follow change-then-use rule. They first change (increment or decrement) the value of their
operand then use the new value in evaluating the expressions.1
g)i) false1
ii) false 1
Solution4
a)intfact( int p)//wrong return type was given
{ longint f=1;
for( j=1;j<=p ; j++)//comma was used instead of semicolon 1
f=f*j;
}
void main( )
{ int n, p;//variable p was undefined
cin>n;
p=fact(n);//variable p was missing
coutendl<p; 1
}
b) by using do….while loop
int M=3;
do{if(M%2==0)1
cout<M*M;
else
cout< M;
coutendl;
M++;
}while(M<=12);
By using for loop
int M;
for(M=3; M<=12; M++)1
{if(M%2==0)
cout<M*M;
else
cout< M;
coutendl;
}
d)void main()2
{for(int i= ‘E’; i>= ‘A’; i--)
{for(int j= ‘A’;j<= i; j++)
{cout< (char)j;
}
coutendl;
}
}
d) Program for find out the number is even or odd using switch case. 2
void main()
{intnum;
cout< “Enter number: ”;
cinnum;
intval=num%2;
switch(val)
{case 0: cout< “Number is even”;
break;
case 1: cout< “Number is odd”;
}
}
e)void main ()2
{longintsal, hra, da;
cout“Enter salary: ”;
cinsal;
if(sal<=10000)
{ hra = sal * 0.10;
da = sal * 0.05;
}
else if(sales < 200000 )
{ hra = sal * 0.15;
da = sal * 0.08;
}
else if(sales < 400000 )
{ hra = sal * 0.20;
da = sal * 0.12;
}
else
{ hra = sal * 0.25;
da = sal * 0.14;
}
couthra“”< da<endl;
}
Solution5
a )i) In call by value, a separate memory is allotted for formal parameters(s).1
So any changes made in formal parameter(s) are not reflected back to actual parameter(s).
In call by reference no separate memory is allocated for formal parameter(s).1
So any changes made in the formal parameter(s) are reflected back to actual parameter(s).
ii)A break statement skips the rest of the loop and jumps over to the statement following the loop 1
A continue statement skips the rest of the loop statements and causes the next iteration of the loop to take place. 1
b) function prototype:2
i) longsum(int[], int);
ii) longcheck(char[]);
c) (ii) math.h (ii)stdio.h (iii) iostream.h (iv) stdio.h (4 * ½ = 2)
d)(i) 50*51*52* (iii) 50* 51* 2
e)1 12
3 4
6 10
10 20
15 35
f) void swap(int &a, int &b)3
{a = a + b;
b = a – b;
a = a – b;
}
Solution6
6 a)Outputs
i)###chhSSRRee2
ii) 16 42
b) intsum_z(int Z[], intn)3
{floatavg;
int sum=0, ctr=0;
for(int i=0l i<nl i++)
{if(Z[i]%10==0)
{sum += X[i];
}
}
return sum;
}
c) void palindrome(char str[]) 3
{int i, j, flag=1;
for(i=0; str[i]!= ‘\0’; i++);
--i;
for(j=0; j<i; j++, i-- )
{if(str[j]!=str[i])
{flag=0;
break;
}
}
if(flag==1)
cout< “String is palindrome”;
else
cout< “String is not palindrome”;
}
Solution7
7 a)The C++ preprocessor directiveis a program that is executed before the source code is compiled.
For ex:- It include the other files through #include directive.2
Definition of symbolic constant and macros through #define directive.
b) Program after removing the syntactical error(s).2
#include<iostream.h
#include<stdio.h//header file was missing
void main()
{struct movie
{charmovie_name[20];//square bracket of array can’t be empty
charmovie_type:
intticket_cost;//can’t initialize with in a structure
}MOVIE:
gets(MOVIE.movie_name);// no structure reference provided
cinMOVIE.movie_type);//gets() can’t be used with single character variable
}
c)struct Student3
{introllno;
char name[10];
float marks;
};
Student S[5]= {{11, “Rahul”, 80.5},
{12, “Sunil”, 78},
{13, “Karan”, 98.5},
{14, “Anuj”, 82.5},
{15, “Piyush”, 76}};
d) 101 X 150
101 X 152
100 X 202
*******************************
Page 1 of 5