CBSE Academic XII STD Computer Science Sample Question Paper 2016 – 17 : cbseacademic.in
Name of the Board : CBSE Academic
Class : XII STD
Document Type : Sample Question Paper
Subject : Computer Science
Year : 2016 – 2017
Website : http://cbseacademic.in/SQP_CLASSXII_2016_17.html
Download Sample Question Paper : https://www.pdfquestion.in/uploads/10039-ComputerScience17.pdf
Marking Scheme : https://www.pdfquestion.in/uploads/10039-ComputerScienceMS.pdf
Computer Science Sample Question Paper :
Sub Code : 083
Time : 3Hrs.
MM : 70
Related : CBSE Academic XII STD Biotechnology Theory Sample Question Paper : www.pdfquestion.in/10031.html
Instructions :
i. All Questions are Compulsory.
ii. Programming Language : Section – A : C++
iii. Programming Language : Section – B : Python
iv. Answer either Section A or B and Section C is compulsory
Section – A :
1 (a) Explain conditional operator with suitable example? 2
(b) Which C++ header file(s) are essentially required to be included to 1
run/execute the following C++ code :
void main()
{
char *word1=”Hello”,*word2=”Friends”;
strcat(word1,word2);
cout<<word1;
}
(c) Rewrite the following program after removing the syntactical errors
(if any). Underline each correction.
#include<conio.h>
#include<iostream.h>
#include<string.h>
#include<stdio.h>
class product
{
int product_code,qty,price;
char name[20]; 2
(d) Write the output of the following C++ program code
Note – Assume all required header files are already being included in the program. 2
(e) Write the output of the following C++ program code
Note – Assume all required header files are already being included in the program. 3
(f) Observe the following program carefully and attempt the given questions
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
clrscr();
randomize();
char courses[][10]={“M.Tech”,”MCA”,”MBA”,”B.Tech”};
int ch;
for(int i=1;i<=3;i++)
{
ch=random(i)+1;
cout<<courses[ch]<<“\t”;
}
getch();
}
2
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?
2 (a) What do you understand by Function overloading or Functional polymorphism? Explain with suitable example. 2
(b) Answer the questions(i) and (ii) after going through the following
class:
class planet
{
char name[20];char distance[20];
public:
planet() //Function 1
{
strcpy(name, “Venus”);
strcpy(distance,”38 million km”);
}
void display(char na[],char d[]) //Function 2
I. What is Function 1 referred as? When will it be executed?
II. Write suitable C++ statement to invoke Function 2.
(c) Define a class DanceAcademy in C++ with following description
Private Members
Enrollno of type int
Name of type string
Style of type string
Fee of type float
(d) Answer the questions (i) to (iv) based on the following
class indoor_sports
{
int i_id;
char i_name[20];
char i_coach[20];
protected:
int i_rank,i_fee;
void get_ifee();
(i) Name the type of inheritance illustrated in the above C++ code.
(ii) Write the names of all the members, which are accessible from the objects belonging to class outdoor_sports.
(iii) Write the names of all the member functions, which are accessible from the member function of class sports.
(iv) What will be the size of the object belonging to class indoor_sports?
3 (a) 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.
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
(b) An array P[30][20] is stored along the column in the memory with each element requiring 2 bytes of storage. If the base address of the array P is 26500, find out the location of P[20][10].
(c) 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:
struct book
{
int bookid;
char bookname[20];
book *next;
};
class Library
{
book *top;
void push();
void pop();
void disp();
~Library();
};
(d) 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:
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
(e) Evaluate the following POSTFIX expression. Show the status of Stack after execution of each operation separately:
45, 45, +, 32, 20, 10, /, -,*
4 (a) Find the output of the following C++ code considering that the binary file sp.dat already exists on the hard disk with 2 records in it.
class sports
{
int id;
char sname[20];
char coach[20];
public:
void entry();
void show();
void writing();
void reading();
}s;
(b) Write a user defined function word_count() in C++ to count how many words are present in a text file named “opinion.txt”. 2
For example, if the file opinion.txt contains following text:
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
(c) 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:
class student
{
int rno;
char sname [20];
int percent;
public:
int retpercent()
{
return percent;
}
Section – B (Python) :
1 (a) Carefully observe the following python code and answer the questions that follow:
On execution the above code produces the following output.
6
3
Explain the output with respect to the scope of the variables.
(b) Name the modules to which the following functions belong:
a. uniform() b. fabs()