On National Teacher Day, meet the 2024-25 Kenan Fellows
CBSE Grade12, Computer Science, Sample Question Paper
1. CBSE Grade 12 - Computer Science Sample QuestionPaper
Section A
1. a. [2]
i) Which language is the predecesor of C++ language?
ii) Is C++ a case sensitive language? Justify your answer.
1.b. [1]
i) Give an example of a function used to handle characters along with the name of the header
file to be included.
ii) An float variable f_num holds the value 2.8. Name the function that can be used to store 2
into an integer variable i_num from the variable f_num. Name the required header file to use
this function.
1.c. Rewrite the following C++ program after removing all the syntactical errors (if
any), underlining each correction. [2]
#include <iostrem.h>
#define g=9.8;
void main()
{
float mass, force;
cout>>"Enter mass";
cin<<mass;
force := mass*g;
cout>>'Force is'>>force;
};
1.d. Write the output from the following C++ program code: [2]
#include <iostream.h>
#define MAX 4
char *Family[MAX]={"Father","Mother","Son","Daughter"};
int Age[MAX];
void ComputeAge(int AgeOfDaughter)
{
Age[MAX-1]=AgeOfDaughter;
Age[MAX-2]=AgeOfDaughter+4;
Age[MAX-3]=(AgeOfDaughter+6)*2;
Age[MAX-MAX]=Age[MAX-3]+5;
}
void main()
2. {
ComputeAge(14);
for(int i=0;i<MAX;i++)
cout<<"Age of "<<Family[][i]<<" is "<<Age[i]<<" years";
}
1.e Write the output from the following C++ program code: [3]
#include <iostream.h>
class SamsungSales
{
int NoOfUnits;
float UnitPrice;
float ProfitAmount,ProfitPercentage;
SamsungSales(float profitpercent)
{
ProfitPercentage = profitpercent;
}
void RegisterSales(int units,float price)
{
NoOfUnits = units;
UnitPrice = price;
}
void ComputeProfit()
{
ProfitAmount = (NoOfUnits*UnitPrice*ProfitPercentage)/100;
}
void DisplaySales()
{
cout<<NoOfUnits<<"->"<<UnitPrice<<"->"<<ProfitAmount<<"n";
}
};
void main()
{
SamsungSales S6(20),S6Edge(30);
cout<<"SAMSUNG Salesn";
S6.RegisterSales(100,40000);
S6.DisplaySales();
S6Edge.RegisterSales(50,50000);
S6Edge.ComputeProfit();
S6Edge.DisplaySales();
S6.ComputeProfit();
S6.DisplaySales();
cout<<"!!! Great going !!!";
}
3. 1.f. Study the following C++ program and select the possible output(s) from it :
Find the maximum and minimum value of L. [2]
#include <stdlib.h>
#include <iostream.h>
void main()
{
char *BowlAnOver[9]={"5 Runs","No Ball","Wide","Dot Ball","1 Run","2 Runs","3
Runs","Boundary","Sixer","Wicket"};
randomize();
long L;
for(int i=0;i<6;i++)
{
L=random(6)+4;
cout<<BowlAnOver[][L]<<"-";
}
}
i) Wicket-No Ball-3 Runs-Boundary-2 Runs-1 Run-
ii) Wicket-2 Runs-Sixer-Bounday-1 Run-3 Runs-
iii) 2 Runs-Wicket-Boundary-Sixer-1 Run-3 Runs-
iv) 2 Runs-1 Run-Sixer-Wide-3 Runs-Boundary-
2. a. [2]
i) Differentiate object oriented programing and procedural progrming.
ii) List two advantages of object oriented programming.
ii) Is C++ a case sensitive language? Justify your answer.
2.b. Answer the questions (i) and (ii) after going through the following C++ class [2]
class SuperSinger
{
public:
int SingerID;
char SingerName[100];
int Votes;
SuperSinger() // Function 1
{
SingerID=0;
strcpy(SingerName,"");
4. Votes=0;
}
SuperSinger(int ID, char S[]) // Function 2
{
SingerID=ID;
strcpy(SingerName,S);
Votes=0;
}
SuperSinger(SuperSinger &S) // Function 3
{
SingerID=S.SingerID;
strcpy(SingerName,S.SingerName);
Votes=S.Votes;
}
Vote()
{
Votes++; // Statement 1
}
~SuperSinger() { } // Function 4
};
i) Name the concept of object oriented programing used in Function 1, Function 2 and Function
3
ii) Name the category of construtor Function 3 belongs to. Define this category.
iii) When is Function 4 invoked? What is it referred to as in object oriented programming?
iv) Name the operator used in Statement 1. In what modes can these operators be used?
2.c. Define a class RetailStore with the following specifications [4]
Private members:
• apparel_id integer
• apparel_name char(30)
• cost_price, sales_price float
• quantity_on_hand integer
Public members:
• A default constructor to reset values
• GetApparelData() to get input from users for the applicable private members and call
ComputeSalesPrice() to determine the SalesPrice
• ComputeSalesPrice() to compute SalesPrice based on the conditions below on profit
percentage:
• 20% if cost_price is greater than 5000
5. • 10% if cost_price is greater than 4000
• 5% if cost_price is greater than 2000
• 3% for all other items
• ShowApparelData() to display all private members
2.d. Answer the questions below based on the code below: [4]
class customer
{
int cust_id;
char cust_name[50];
char cust_tel[20];
protected:
void StoreCustomer();
pubic:
customer();
void GetCustomer();
void DispCustomer();
};
class branch
{
int br_id;
char br_name[50];
protected:
char br_addr[200];
char br_tel[20];
public:
branch();
void GetBranch();
void DispBranch();
};
class telco : private branch, public customer
{
int telco_id;
char telco_name[100];
float turnover;
public:
telco();
void GetTelco();
void DispTelco();
6. };
i) Write the names of all data members and member functions accessible from an instance of
class telco.
ii) List the data members accessible from
a) GetTelco()
b) DispBranch()
iii) What type of inheritance is implemented in the above code? Show a diagramatic
representation of the inheritance implemented.
iv) Declare an instance of telco class called IndiaTel. How many bytes are required to store this
object.
[3]
3.a. An array T[-1..35][-2..15] is stored in the memory along the row with each element occupying 4
bytes. Find out the base address and address of element T[20][5], if an element T[2][2] is stored at the
memory location 3000. Find the total number of elements stored in T and number of bytes allocated to T
[3]
3.b. Write a function WorldCup2015() in C++ to sort an array of the following structure in descending
order of Points using bubble sort
struct WorldCupTeams
{
char Country[50];
int Points;
};
[4]
3.c. Write member functions to PUSH and POP a dynamically allocated stack with objects derived from the
following structure:
struct CBSEStudents
{
int Grade;
int NoOfStudents;
CBSEStudents *next;
};
3.d. [2]
Write a function in C++ to print the sum all the numbers divisible by 6 in a 2-dimnsional array which is
passed as an argument to the function.
3.e. [2]
Evaluate the following postfix expression. Show the status of stack after execution of each operation
separately.
4,15,*,60,/,4,4,-,5,*,+
4.a. Write C++ statements for the following requirements: [1]
7. i) Open binary file "MyData.bin" in append mode with the required declaration
ii) Move the file pointer to read the file 10 bytes before the current position
4.b. [2]
Write a C++ function to count the number of sentences in the file "MyProjectReport.txt" and
display the count.
4.c. [3]
Write a C++ function to search customers having invoice amout more than Rs. 1,00,000 from
binary file "Customers.dat" and display the details of these customers. Assume the availability of
the following class that implements the requirement.
class Customers
{
int cust_id;
char cust_name[50];
char cust_addr[200];
float invoice_amount;
public:
void GetCustomerData()
{
cin>>cust_id>>cust_name>>cust_addr>>invoice_amount;
}
void Display()
{
cout <<"nID:" <<cust_id;
cout<<"tName:" <<cust_name;
cout<<"tAddr:" <<cust_addr;
count<<"tInvoice Amount:" <<invoice_amount<<"n";
}
float GetInvoiceAmount() {return invoice_amount;}
};
Section B
5.a. [2]
i) Define primary key
ii) What datatype can be used to store your date of birth?
5. Based on the table below answer the questions in (b) and (c)
Table: DEPARTMENTS
8. Dept_No Dept_Name Manager_ID
D10 Sales 1234
D20 Finance 1235
D30 Human Resources 1236
D40 Marketing 1237
Table: EMPLOYEES
Emp_no Emp_Name Dept_No Grade
1234 Priya D10 100
1100 Renga D10 50
1110 Harini D20 50
1120 Smitha D40 60
1235 Lakshmi D20 100
1130 Anandhi D30 70
1236 Abi D30 100
1140 Muthu D20 50
1237 Suji D40 100
1150 Kamala D40 60
5.b. Write SQLs for the following: [4]
i) List the employees sorted by dept_no
ii) List the departments in descending order of dept_name
iii) Display dept_name, manager_id and the name of the manager
iv) List the dept_name and number of employees in each department
5.c. Write the output for the following SQL commands [2]
i) SELECT dept_no, COUNT(*) FROM employees GROUP BY dept_no;
ii) SELECT COUNT(DISTINCT dept_no) FROM employees;
9. iii) SELECT Grade, COUNT(*) FROM employees GROUP BY Grade;
iv) SELECT emp_name, dept_name FROM employees e, departments d WHERE
d.dept_no=e.dept_no;
6.a. Name the law shown below and veriy using truth table: [2]
X+Y.Z = (X+Y) . (X+Z)
6.b. Draw a logical circuit for the following boolean expression: [2]
_ _
F = (A.B) + (C+D)
6.c. Write the Sum of Product form of the function F(U,V,W) for the following truth table
representation of F: [1]
U V W F
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 1
6.d. Obtain the minimal form for the following Boolean expression using K-map. [3]
F(M,N,O,P) = SUM(2, 4, 5, 9, 10, 11, 12)
7.a. [1]
i) What is network?
ii) List 2 reasons to have network
10. 7.b. What is mobile computing? [1]
7.c. Expand the following: [1]
i) CDMA
ii) DHTML
7.d. Differentiate client side scripting and server side scripting [1]
7.e. BlueSoft company has the following details: [4]
• Distance between Development Block & Research block is 100m
• Distance between Development Block & Admin block is 20 m
• Distance between Research block & Admin block is 40 m
• 20 computers are required in Development block
• 100 computers are required in Admin block
• 80 computers are required in Research block
i) In which block should the server be installed?
ii) Design the cabl layout & represent the same diagramatically such that effective
communication would occur
iii) Recommend the bst possible connection from the list below from this company in Delhi to
their client in London:
• Satellite link
• Infrared
• Ethernet cable
iv) Which of the following device(s) is best recommended to connect the computers in the Delhi
office?
• Switch
• Modem
• Gateway
7.f. Differntiate freeware and shareware [1]
7.g. What is virus? List 2 types of viruses [1]