12th Standard CBSE Syllabus & Materials
12th Standard CBSE
CBSE 12th Economics Government Budget and the Economy Previous year Question Papers Study Material - QB365 Set A
NEW12th Standard CBSE
CBSE 12th Computer Science Interface Python with MySQL - New Previous year Question Papers Study Material - QB365 Set A
NEW12th Standard CBSE
CBSE 12th Computer Science Database Concept - New Previous year Question Papers Study Material - QB365 Set A
NEW12th Standard CBSE
CBSE 12th Computer Science Data Communication - New Previous year Question Papers Study Material - QB365 Set A
NEW12th Standard CBSE
CBSE 12th Computer Science Data Structures - New Previous year Question Papers Study Material - QB365 Set A
NEW12th Standard CBSE
CBSE 12th Computer Science Functions - New Previous year Question Papers Study Material - QB365 Set A

Published on: 05/03/2019
Important 2 Marks Test
Download CBSE Class 12th Standard CBSE Computer Science question papers, sample papers, important questions, and previous year solved papers in PDF format. Get free study materials, NCERT solutions, and exam preparation resources for Class 12th Standard CBSE Computer Science
Questions + Answers key
Take MCQ Computer Science Test

1.
Given the following truth table, device a Sum of Product(SOP) and Product of Sum(POS) form of boolean expression from it:
| A | B | C | F(A,B,C) |
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 0 |
2.
Explain the following terms in short:
(i) DHTML
(ii) ISP
3.
An array MAT[30][10] is stored in the memory along the column with each of the element occupying 2 bytes. Find out the base address and address of element MAT[20][5], if an element MAT[5][7] is stored at the memory location 1000.
4.
Write a function in c++ to find and display the sum of each row and each column of a two dimensional array of type float. Use the array and its size as parameters with float as its return type.
5.
Answer the questions (i) and (ii) after going through the following class:
class Interview
{
int Month;
public:
Interview(int y) //Constructor 1
{
Moth = y;
}
Interview(Interview &t);
//Constructor 2
};
(i) create an object, such that it invokes Constructor 1.
(ii) Write the complete definition for Constructor 2.
6.
Find the output of the following program:
#include<iostream.h>
#include<conio.h>
struct land
{
int length;
int breadth;
float area;
};
void calarea(land &P1,int y=10)
{
P1.area=P1.length*P1.breadth;
P1.area/=y;
P1.length++;
P1.breadth++;
}
void main()
{
land first={20,50},second={10,30};
calarea(first);
cout<<first.area<<'#'<<first.length<<'#'<<first.breadth;
cout<<endl;
calarea(second,5);
cout<<second.area<<'#'<<second.length<<'#'<<second.breadth;
getch();
}
7.
Find the output of the following program:
#include<iostream.h>
{
int Length, Breadth, Height;
};
void Occupies(Package M)
{
cout<<M>Length<<"X"<<M.Breadth<<"X";
cout<<M.Height<<endl;
}
void 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);
}
8.
Write a user defined function AddEnd2(int A[][4], int N, int M) in C++ to find and display the sum of all the values, wich are ending with 2(i.e units place is 2).
e.g.if the content of array is:
| 22 | 16 | 12 |
| 19 | 5 | 2 |
The output should be
36
9.
Find the output of the following program:
#include<iostream.h>
struct THREE_D
{
int x,y,z;
};
void MoveIn(THREE_D &T,int Step=1)
{
T.x==Step;
T.y-=Step;
T.z+=Step;
}
void MoveOUt(THREE_D &T,int Step=1)
{
T.x-=Step;
T.y+=Step;
T.z-=Step;
}
void main()
{
THREE_D T1={10,20,5},T2={30,10,40};
MoveIn(T1);
MoveOut(T2,5);
cout<<T1.x<<","<<T1.y<<","<<T1.z<<endl;
cout<<T2.x<<","<<T2.y<<","<<T2.z<<endl;
MoveIn(T2,10);
cout<<T2.x<<","<<T2.y<<","<<T2.z<<endl;
}
10.
What is the benefit of using default parameter/ argument in a function? Give a suitable example to illustrate it using C++ code.
11.
Go through the C++ code shown below and find out the possible output from the suggested output i) to iv). Also write the least value and higher value, which can be assigned to the variable Guess.
#include<iostream.h>
#include<stdlib.h>
void main()
{
randomize();
int Guess,High=4;
Guess=random(high)+50;
for(int C=Guess;C<=55;C++)
cout<<C<<"#";
}
i) 50#51#52#53#54#55# ii) 52#53#54#55#
iii) 53#54# iv) 51#52#53#54#55#
12.
Read the following C++ code carefully and find out, which out of the given option(i) to (iv) are the expected correct outputs of it.Also write the maximum and minimum value that can be assigned to the variable Taker used in the code.
void main()
{
int GuessMe[4]={100,50,200,20};
int Taker=random(2)+2;
for (int Chance=0; Chance<Taker: Chance++)
cout<<GuessMe[Chance]<<"#";
}
i) 100# ii) 50#200# iii) 100#50#200# iv) 100#50#
13.
Answer the question (i) and (II) after going through the following class:
class Race
{
int CarNo,track;
public:
Race():
Race(int CN);
Race(race &R);
void Register();
void Drive();
};
void main()
{ Race R;
:
}
(i) out of the following, which of the option is correct for calling Function 2?
Option 1 - Race T(30);
Option 2 - Race U(R);
(ii) Name the feature of object oriented programming, which is illustrate by Function1, Function 2 and Function 3 combined together.
14.
What do you understand by a member function?How does a member function differ from an ordinary function?
15.
rewrite the following program after removing the synthetical error (if any). Underline each correction.
#include<iostream.h>
#include<stdio.h>
class AUTO
{
char model[20];
float price;
AUTO()
{
price = 0;
strcpy (Model),"NULL";
}
public
void GetInfo()
{
cin>>price;
gets(model);
}
void PutInfo()
{
cout<<etw(10)<<price<<setw(10);
cout<<Mode<<end1;
}
}
void main()
{
AUTO Car;
Car.GetInfo();
Car.PutInfo();
}
16.
c^^
17.
constructor
18.
When object is used as function argument, then how call by value is differ from call by reference?
19.
(i) Give the number of elements in a circular queue.
(ii) With 12 memory locations if front=10 and Rear=3.If 4 elements are deleted from above queue, what will be the value of Front and Rear?
20.
How are objects implemented in C++?
21.
Rewrite the following set of if-else statement in terms of switch-case statement.
int num,val;
cin>>num;
if(num==5)
{
val=num*5;
cout<
}
else if (num==10)
{
val=num*5;
cout<
}
22.
A database is to contain information about person and skills. At a particular time, the following persons are represented in the database, and their skills are as indicated
| Person | Skills |
| Vikas | Engineering |
| Harvinder | Programming |
| Ritesh | Operating and Engineering |
For each person, the database contains several details like Mobile number, Address. For each skill, it contains an identification of the appropriate skill and other information. Draw a relational view for this data.
23.
What do you understand by primary key? Give a suitable example of the primary key from a table containing some meaningful data.
24.
What is the significance of (::) scope resolution operator?
25.
Give the following code fragment
int a = 5;
cout< (i) What output does the above code fragment produce?
(ii) What is the effect of replacing ++a with a + 1?
1.
| A | B | C | F | MInterms | Maxterm |
| 0 | 0 | 0 | 1 | \(\bar { A } .\bar { B } .\bar { C } \) | |
| 0 | 0 | 1 | 1 | \(\bar { A } .\bar { B } .C\) | |
| 0 | 1 | 0 | 0 | \(A+\bar { B } +C\) | |
| 0 | 1 | 1 | 1 | \(\bar { A } .B.C\) |
| A | B | C | F | Minterms | Maxterm |
| 1 | 0 | 0 | 0 | \(\bar { A } +B+C\) | |
| 1 | 0 | 1 | 1 | \(A.\bar { B } .C\) | |
| 1 | 1 | 0 | 1 | \(A.B.\bar { C } \) | |
| 1 | 1 | 1 | 0 | \(\bar { A } +\bar { B } +\bar { C } \) |
Sum of Products(SOP) expression contain sum of all minterms for output as 1.
\(=\bar { A } .\bar { B } .\bar { C } +\bar { A } .\bar { B } .C+\bar { A } .B.C+A.\bar { B } .C+A.B.\bar { C } \)
\(=\sum (0,1,3,5,6)\)
Product of Sum(POS) expression contains product of all maxterms for output as 0.
\(=(A+\bar { B } +C).(\bar { A } +B+C).(\bar { A } +\bar { B } +\bar { C } )\quad \)
\(=\prod (2,4,7)\)
2.
(i) DHTML DHTML stands for Dynamic HyperText Markup Language. It refers to the web content that changes according to the user request. It will react the user input without sending requests to the web server.
(ii) ISP ISP stands for Internet Service Provider. It refers to the company that provides Internet Services. Some common examples of ISPs are Airtel, BSNL, Tata docomo, etc.
3.
Base address B= ?
Number of rows M = 30
Element size W = 8
ir, ic = 0
Array in column major order
Address of MAT[i][j] = B+W(J-Ic)+(I=Ir))
MAT[5][7] = 1000
1000 = B + 8[30(7-0)+(5-0)]
1000 = B + 8[30(7)+(5)]
1000 = B + 8(210+5)
1000 = B + 8(215)
1000 = B + 1720
B = 1000 - 1720
B = -720
Address of MAT[20][5]
=-720 + 8[30(5 - 0) + (20 - 0)]
| = -720 + 8[p30(5) + 20]
= -720 + 8 (150 + 20)
= -720 + 8(170)
= -720 + 1360 = 640
4.
void RowColSum(float A[10][10],int r, int c)
{
int i,j;
float RS[10],CS[10]; // find row sum
for(i=0; i<r; i++)
{
RS[i] = 0;
for(j=0;j<c;j++)
RS[i] += A[i][j];
} //find column sum
for(j=0-;j<c;j++)
{
CS[j] = 0;
for(i=0;i<r;i++)
CS[j][ += A[i][j];
}
//Display 2D arraywith rowsum and colsum
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
cout<<A[i][j]<<"\t";
cout<<"sum="<<CS[j]<<"\t";
}
for(j=0;j<c;j++)
cout<<"sum="<<CS[j]<<"\t";
cout<<end1;
}
5.
(i) Interview objl(7);
(ii) Interview(Interview &t)
{
Month = t.month;
}
6.
Output
100#21#51
60#11#31
7.
Output
101X150X50
101X152X50
101X202X49
8.
void Add end(int A[] [4], int N, int M)
{
int sum = 0;
for(int j=0;j<M;J++)
{
for(int j=0;j<m;j++)
{
if(A[i][j] == 2)
um += A[i][j];
}
}
cout<<sum;
}
9.
Output
11,19,6
25,15,35
35,5,45
10.
A default parameter is a function parameter that has a default value provided to it. If the user does not supply a value for this parameter, the default value will be used.
If the user does supply a value for the default parameter, the user supplied value is used.
Consider the following program:
void Printvalues(int nValue1, int nValue2=10)
{
cout<<"1st value:"<<nValue1<<endl;
cout<<"2nd value:"<<nValue2<<endl;
}
int main()
{
PrintValue(1);
//nValues2 will use default parameter
//of 10
PrintValues(3,4);
//override default value for nValue2
return 0;
}
Output
1st value:1
2nd value:10
1st value:3
2nd value:4
11.
Possible output is only i) and ii)
Least value of Guess=50
Highest value of Guess=53
12.
Correct output for the given code would be option iii) and iv).
Minimum value of variable Taker=2
Maximum value of variable Taker=3
13.
(i) Option 1 - Race T(30 is correct.
(ii) Constructor overloading.
14.
Member functions are functions defined within class that act on data
members in the class.The use of member functions distinguishes a class from struct.Where as,an ordinary function can be called in any
function can be called only by using its object.
The member function is a member of its own class but an ordinary
function is not.
15.
#include<iostream.h>
#include<stdio.h>
#include<iomanip.h>
#include<String.h>
class AUTO
{
char model[20];
float price;
public:
AUTO()
{
price = 0;
strcpy (Model),"NULL";
}
public
void GetInfo()
{
cin>>price;
gets(model);
}
void PutInfo()
{
cout<<etw(10)<<price<<setw(10);
cout<<Mode<<end1;
}
};
void main()
{
AUTO Car;
Car.GetInfo();
Car.PutInfo();
}
16.
C^^
17.
In class-based object-oriented programming, a constructor (abbreviation: ctor) in a class is a special type of subroutine called to create an object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables.
18.
Difference between call by value and call by reference, when object is used as a function argument are as follows:
| Call by value | Call by reference |
| A copy of object is passed to function. Any change made in passed object is not reflected back to original object. e.g. Time ob3 ob3.addTime(ob1,ob2);//call by value. void addTime(Time \({ T }_{ 1 }\), Time \({ T }_{ 2 }\)) { __ __ __ __ } For large size of object, copying object will consume large time and memory. |
The memory address of object is passed to function. |
19.
(i) if Front < Rear then
The total number of elements = Rear - Front + 1
if Front > Rearthen
The total number of elements = N +(Rear - Front) + 1
(ii) Initial circular queue with size of 12 element
0 1 2 3 4 5 6 7 8 9 10 11
| 10 | 20 | 30 | 40 | 50 | 60 |
Rear Front
After delecting 4 elements,the circular queue will be like
0 1 2 3 4 5 6 7 8 9 10 11
| 30 | 40 |
Front Rear
The value of Front=2
The value of Rear = 3
20.
Objects are implemented in C++ as follows:
(i) The properties/characteristics are implemented by the data members or member variables.
(ii) Behaviour of an object is determined by its member function or method.
(iii) To identify each object, unique name is given to each of the objects.
21.
int num, val;
cin>>num;
switch(num)
{
case 5: val=num*5;
cout<
break;
case 10: val =num*5;
cout<
break;
}
22.
Person
| Pname | Mobile Number | Address | - |
| Vikas | - | - | - |
| Harvinder | - | - | - |
| Ritesh | - | - | - |
Skills
| Skill | Code | - |
| Engineering | - | - |
| Programming | - | - |
| Operating and Engineering | - | - |
23.
A primary key is a set of one or more attributes that can uniquely identify tuples within the relation.
e.g. Table: Item
| ItemNo | Name | State | City |
| 11 | Pastry | 10 | Ajmer |
| 12 | Pizza | 15 | Delhi |
| 13 | Cake | 5 | Puna |
| 14 | Burger | 35 | Delhi |
The attribute ItemNo is a primary key in ITEM table as it contains a unique value for each tuple in a relation.
24.
Member functions can be defined within the class definition or separately using scope resolution operator(::), Scope resolution operator specifies that the scope of the function is restricted to the class_name.
#include<iostream.h>
class Box
{
double length;
double breadth;
double height;
public:
double getVolume(void);
};
double Box :: getVolume(void)
{
return length*breadth*height;
}
25.
(i) 665
This is because when multiple values are cascaded with cout, calculations take place from right to left but printing takes place from left to right.
(ii) After replacing ++a with a+1, the output of the code will be:
565
12th Standard CBSE Syllabus & Materials
12th Standard CBSE
CBSE 12th Computer Science Python Revision Tour I - New Previous year Question Papers Study Material - QB365 Set A
NEW12th Standard CBSE
CBSE 12th Business Studies Planning Important Questions And Answers Study Material - QB365 Set A
NEW12th Standard CBSE
CBSE 12th Business Studies Business Environment Important Questions And Answers Study Material - QB365 Set A
NEW12th Standard CBSE
CBSE 12th Business Studies Principles of Management Important Questions And Answers Study Material - QB365 Set A
CBSE 12th Standard CBSE Subjects
CBSE Standards