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: 29/12/2018
Class 12 Pre Public Model Exam
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.
Convert \((\overset { \_ \_ \_ \_ \_ \_ \_ }{ \bar { X } .Y } ).(\overset { \_ \_ \_ \_ \_ \_ \_ \_ }{ \bar { X } .\bar { Z } } )\) into canonical Sum of Products form
2.
Explain the following terms in short:
(i) DHTML
(ii) ISP
3.
Define a function in c++ to print the product of each column of a two dimension integer array passed as the argument of the function.
e.g.if the dimensional array contain:
| 1 | 2 | 4 |
| 3 | 5 | 6 |
| 4 | 3 | 2 |
| 2 | 1 | 5 |
Then, the output should appear as
product of column 1 = 24
product of column 2 = 30
product of column 3 = 240
4.
Find the output of the following program:
#include<iostream.h>
struct POINT
{
int x,y,z;
};
void StepIn(POINT &P,int Step=1)
{
P.x+=Step;
P.y-=Step;
P.z+=Step;
}
void StepOut(POINT &P,int step=1)
{
P.x-=step;
P.y+=step;
P.z-=step;
}
void main()
{
POINT P1={15,25,5},P2={10,30,20};
StepIn(P1);
StepOut(P2,4);
cout<<P1.x<<','<<P1.y<<','<<P1.z<<endl;
cout<<P2.x<<','<<P2.y<<','<<P2.z<<endl;
StepIn(P2,12);
cout<<P2.x<<','<<P2.y<<','<<P2.z<<endl;
}
5.
Define a class RESTRA in C++ with following descriptions:
private members
| FType | Sticker |
| Vegetarian | GREEN |
| Contains Egg | YELLOW |
| Non-vegetarian | RED |
Public members
6.
Observe the following C++ code carefully and obtain the output, which will appear on the screen after execution of it.
#include
class Aroundus
{
int Place,Humidity,Temp;
public:
Arounds(int p = 2)
{
Place = P;
Humanity = 60;
Temp = 20;
}
void Hot(int T)
{
Temp += T;
}
void Humid(int H)
{
Humidity += H;
}
void JustSee()
{
cout<
};
void main()
{
Aroundus A, B(5);
A.Hot(10);
A.JustSee();
B.Humid(15);
B.Hot(2);
B.JustSee();
A.Humid(5);
A,justSee();
}
7.
What are the drawbacks of linear queue?
8.
Find the output of the following program:
#include<iostream.h>
void main()
{
int A=5,B=10;
for( int I=1; I<=2;I++)
{
cout<<"Line 1="<<A++<<"&"<<B-2<<endl;
cout<<"Line 2="<<++B<<"&"<<A+3<<endl;
}
}
9.
A database is storing the information about teacher and its related topic. If the following are in the school:
| Teacher | Topic |
| Suman | LAN |
| Ajay | DBMS |
| S.Ray | Thermal |
| P.Lal | Organics |
| M.Singh | Algebra |
For each teacher, the address of the teacher is also present in the database and for each topic to which subject it belongs. The database also contains which teacher takes how many classes. Draw a relational view for above data.
10.
How does a class enforce data hiding, abstraction, and encapsulation?
11.
What output will be the following code fragment produce?
int val, res, n = 1000;
cin>>val;
res = n + val > 1750 ? 400 :200;
cout<<res;
(i) if the input is 2000
(ii) if the input is 1000
(iii) if the input is 500.
12.
Write the output of the following program:
#include<iostream.h>
static int i=100;
void Print(char *p)
{
p="pass";
cout<<"Value is"<<p<,end1;
}
void main()
{
char *q="Best of Luck";
print(q);
cout<<"New value is"<<q;
}
13.
Find the output of the following program:
#include<iostream.h>
#include<conio.h>
void main()
{
int *Pointerarray[10];
int marks[]={75,68,90,34,0,10,90,65};
for(int i=0;marks[i]!=0;I++)
{
pointerArray[I]=&marks[I];
*(PointerArray[I]+=5;
}
int index=0;
while(index<I)
{
int p=*(PointerArray[index]);
if(p>60)
cout<<p<<:,";
index++;
}
getch();
}
14.
To illustrate the concept of passing entire structure as function argument using pass by reference.
15.
To show the use of goto statement.
16.
To show the data members are passed by value.
17.
Given the following class:
char *msg[]={:overflow"."underflow"};
class stack
{
int top;//the stack pointer
int stk[5];//the elements
void err_rep(int e_num)
{
cout<
//report error message
public:
void init(){top=0;}
//initialise the stack pointer
void push(int);
//put new value in stack
void pop();
//get the pop value
};
Define pop outside the stack.In your definition take care of underflow condition. Function pop should invoke error_rep to report underflow
18.
Write a function in C++ to count number of uppercase alphabets prsent in a text file ARTICLE.TXT.
19.
What is default constructor? How is different from destructor?
20.
Answer the questions (a) and (b) on the basis of the following tables SHOPPE and ACCESSORIES.
TABLE SHOPPE
| Id | SName | Area |
| S001 | ABC Computeronics | CP |
| S002 | All Infotech Media | GK II |
| S003 | Tech Shoppe | CP |
| S004 | Geeks Tecno Soft | Nehru Place |
| S005 | Hitech Tech Store | Nehru Place |
TABLE ACCESSORIES
| No | Name | Price | Id |
| A01 | Mother Board | 12000 | S01 |
| A02 | Hard Disk | 5000 | S01 |
| A03 | Keyboard | 500 | S02 |
| A04 | Mouse | 300 | S01 |
| A05 | Mother Board | 13000 | S02 |
| A06 | Keyboard | 400 | S03 |
| A07 | LCD | 6000 | S04 |
| T08 | LCD | 5500 | S05 |
| T09 | Mouse | 350 | S05 |
| T10 | Hard Disk | 4500 | S03 |
(a) Write the SQL queries:
(i) To display Name and price of all the Accessories in ascending order of their price.
(ii) To display id and Sname of all Shoppe located in Nehru place.
(iii) To display Minimum and Maximum price of each Name of Accessories.
(iv) To display Name,Price of all Accessories and their respective SName,where they are available.
(b) Write the output of the following SQL commands;
(i) SELECT DISTINCT NAME FROM ACCESSORIES WHERE PRICE>=5000;
(ii)SELECT AREA.COUNT (*) FROM SHOPPE GROUP BY AREA;
(iii)SELECT COUNT (DISTINCT AREA) FROM SHOPPE;
(iv)SELECT NAME,PRICE*0.05 DISCOUNT FROM ACCESSORIES WHERESNO IN ('S02','S03');
21.
Answer the questions(i) to (iv) based on the following code:
class Base
{
int A1;
void BF1();
protected:
int B1;
void BF2();
public:
int C1;
void BF3();
}ob1;
class Middle : private Base
{
int A1;
protected:
int B2;
void MF1();
public:
int C2;
void MF2();
}ob2;
class Derived : protected Middle
{
void DF1();
int A3;
public:
int B3;
void DF2();
}ob3;
(i) Name the member function accessible by the objects of Derived.
(ii) Name the data members that are accessible in function DF1().
(iii) What would be the size of class Derived objects?
(iv) Name the data members that are accessible in function F1().
22.
Write a program in C++ to print first 10 multiples of an integer N, where N is to be entered by user:
23.
State the distributive laws of boolean algebra. How do they differ from the distributive laws of ordinary algebra?
24.
What is the difference between video conferencing and chat?
25.
Create a table named PROGRAMMERS with the following structure:
| P_Name | 20 Characters |
| DOJ | Date |
| SAL | NUMBER |
i) Display the name of the programmer, which has the highest salary.
ii) Update the salary of all programmer by 2000 whose name start with letter 'R'.
26.
Which value of x will be printed in following case and why?
int x=9;
void main()
{
int x = 10;
cout<<x;
}
27.
Why function overloading is used?
1.
Step 1 Simplify the given expression using appropriate theorems/ rules.
\((\overset { \_ \_ \_ \_ \_ \_ \_ }{ \bar { X } .Y } ).(\overset { \_ \_ \_ \_ \_ \_ \_ \_ }{ \bar { X } .\bar { Z } } )=(\overset { \_ \_ \_ }{ \bar { X } } +\bar { Y } ).(\overset { \_ \_ \_ }{ \bar { X } } +\overset { \_ \_ \_ }{ \bar { Z } } )\\ =(X+\bar { } ).(X+Z)\\ =X.X+X.Z+X.\bar { Y } +\bar { Y } .Z\\ =X+X.Z+X.\bar { Y } +\bar { Y } .Z\\ =X.(1+Z)+X.\bar { Y } +\bar { Y } .Z\\ =X+X.\bar { Y } +\bar { Y } .Z\\ =X(1+\bar { Y } )+\bar { Y } .Z=X+\bar { Y } .Z\)
Since it is a 3 variables expression, a product term must have all 3 variables.
Step 2 Wherever a variable is missing, multiply that term with (missing variable+ compliment of missing variable)
\(=X.(Y+\bar { Y } ).(Z+\bar { Z } )+(X+\bar { X } ).\bar { Y } .Z\\ =(X.Y+X.\bar { Y } ).(Z+\bar { Z } )+X.\bar { Y } .Z+\bar { X } .\bar { Y } .Z\\ =X.Y.Z+X.Y.\bar { Z } +X.\bar { Y } .Z+X.\bar { Y } .\bar { Z } +X.\bar { Y } .Z+\bar { X } .\bar { Y } .Z\)
Step 3 Remove all duplicate term, i.e.,
\(=X.Y.Z+X.Y.\bar { Z } +X.\bar { Y } .Z+X.\bar { Y } .\bar { Z } +\bar { X } .\bar { Y } .Z\)
This is the desired canonical Sum of Products form.
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.
void ColProd(int A[][10], int r, int c)
{
int Prod,i,j;
for(j=0;j<c;j++)
{
Prod = 1;
for(i=0;i<r;i++)
Prod *= A[i][j];
cout<<"Product of column"<<j+1<<"="<<Prod<<end1;
}
}
4.
Output
16,24,6
6,34,16
18,22,28
5.
class RESTRA
{
int FoodCode;
char Food[30],FType[20],Sticker[20];
void GetSticker()
{
if(strcmp(FType,"Vegeterian")==0)
strcpy(Sticker,"GREEN");
else if(strcmp(FType,"Contains Egg")==0)
strcpy(Sticker,"YELLOW");
else if(strcmp(FType,"Non-vegetarian")==0)
strcpy(Sticker,"RED");
}
public:
void GetFood()
{
cout<
gets(Food);
gets(FType);
}
6.
2:30&60%
5:22&75%
2:30&65%
7.
Drawbacks of linear queue are:
By the definition of a queue, when we add an element in queue, Rear pointer is increased by 1 whereas, when we remove an element, Front pointer is increased by 1.
But, in array implementation of queue this may cause problem as follows:
Consider the operations performed on a queue(with SIZE=5) as follows:
(i) Initially, empty queue is there so, Front=-1 and Rear=-1
Front=-1
Rear=-1
0 1 2 3 4
(ii)When we add 5 elements in queue, the state of the queue becomes as follows with Front=0 and Rear=4
Front=0
Rear=4
0 1 2 3 4
| 2 | 6 | 5 | 1 | 9 |
(iii) Now suppose, we delete 2 elements from queue,then the state of the queue becomes as follows, with Front=2 and Rear=4
Front=2
Rear=4
0 1 2 3 4
| 5 | 1 | 9 |
(iv) Now, actually we have deleted 2 elements from queue so, there should be space for another 2 elements in the queue, but as Rear pointer is pointing at last position. So, queue overflow condition is reached.
(Rear==SIZE-1) is true, we can't insert new element in the queue even if it has an empty space.To overcome this problem, there is another variation of queue called circular queue.
8.
Line 1=5&8
Line 2=11&9
Line 1=6&9
Line 1=12&10
9.
The Relational View of above data is:
Teacher
| Tname | Taddress |
| Suman | - |
| Ajay | - |
| S.Ray | - |
| P.Lal | - |
| M.Singh | - |
Topics
| Topics | Subject |
| LAN | - |
| DBMS | - |
| Thermal | - |
| Organics | - |
| Algebra | - |
Class
| Tname | Topic | Classes |
| Suman | LAN | - |
| Ajay | DBMS | - |
| S.Ray | Thermal | - |
| P.Lal | Organics | - |
| M.Singh | Algebra | - |
10.
A class binds data and its associated functions together under one unit, which enforcing encapsulation that means wrapping up data and associated functions together into a single unit.
Member of the class can be group into three parts: public, private, and protected.The private and protected functions remain hidden from outside world.Thus, through private and protected members a class enforce the data hiding.The public member can be used outside the world, that is important and necessary information, rest of the thing remain hidden which is nothing but abstraction.We can say that an abstraction means representing only essential features without expressing background details.
11.
(i) 400 because the arithmetic operator + has higher precedence than ?: operator, so the n+val condition is taken as n+val>1750=(1000+200)>1750 is true.
(ii) 400 because (1000+1000)>1750 is true.
(iii) 200 because (1000+500)>1750 is false.
12.
output
Value is Pass
New value is Best of Luck
13.
output
80,73,95,
14.
#include<iostream.h>
#include<conio.h>
struct students_record
{
int s_rollno,s_class;
};
void display(struct students_record*s1);
void main()
{
struct students_record s1;
s1.s_rollno=14;
s1.s_class=2;
display(&s1);
getch();
}
void display(struct students_record *s1)
{
cout<<"\nRoll no: "<<s1->s_rollno;
cout<<"\nClass: "<<s1->s_class;
}
Output
Roll no:14
Class:2
15.
#include<iostream.h>
#include<conio.h>
void main()
{
int i, j;
for(i=0; i<10; i++)
{
cout<<"\n Outer loop executing. i="<<i;
for(j=0; j<2; j++)
{
cout<<"\n Inner loop executing. j="<<j;
if(i==3)
goto stop;
}
}
cout<<"\n Loop exited. i="<<i;
stop;
//This message does not print
cout<<"\n Jumped to stop. i="<<i;
getch();
}
Output
Outer loop executing. i=0
Inner loop executing. j=0
Inner loop executing. j=1
Outer loop executing. i=1
Inner loop executing. j=0
Inner loop executing. j=1
Outer loop executing. i=2
Inner loop executing. j=0
Inner loop executing. j=1
Outer loop executing. i=3
Inner loop executing. j=0
Jumped to stop. i=3
16.
Output
Enter the time
HOURS 10
MINUTES 50
SECONDS 30
Enter the time
HOURS 12
MINUTES 15
SECONDS 40
Resultant time
HOURS 23
MINUTES 6
SECONDS 10
17.
The function is:
void stack:: pop()
{
if(top==0)
err_rep(1);
else
cout<
18.
int countupcase()
{
ifstream fin("ARTICLE.TXT");
char ch;
int count = 0;
while(!fin.eof())
{
fin>>ch;
if(isupper(ch))
count++;
}
fin.close();
return count;
}
19.
A constructor is a member function having the same name as that of class and it gets invoked every time when new object is created.It is used to construct and initialize object values.A constructor that accepts no parameters is known as default constructor.
A destructor function has the same name as that of constructor function, preceded with a tilde (~) sign. it gets invoked every time an object goes out of scope. it is used to destroy objects.
20.
(a)(i) SELECT Name, Price
FROM ACCESSORIES
ORDER BY Price;
(ii) SELECT Id, SName
FROM SHOPPE
WHERE Area='Nehru Place';|
(iii) SELECT MIN(Price)"Minimum Price",
MAX(Price) "Maximum Price", Name
FROM ACCESSORIES
GROUP BY Name;
(iv) SELECT Name,Price, SName
FROM ACCESSORIES A, SHOPPE S
WHERE A.Id=S.Id;
but this query enable to show the result because A.Id and S.Id are not identical.
(b)(i)
| NAME |
| MotherBoard |
| Hard Disk |
| LCD |
(ii)
| AREA | COUNT(*) |
| GK II | 1 |
| Nehru Place | 2 |
| CP | 2 |
(iii)
| Count(Distinct area) |
| 3 |
(iv) The given query will result in an error as there is no column named SNo in ACCESSORIES table.
21.
(i) DF2()
(ii) B2, C2, A3, B3
(iii) 16
(iv) Data members that are accessible in function F1() are none, because the function F1() is not the member function of any class.
22.
#include
#include
void main()
{
int n, i;
clrscr();
cout<<"Enter the number to find the multiple";
cin>>n;
for(i=1;i<=10;i++)
cout< getch();
}
23.
( )
Distributive laws of boolean algebra state that:
(i) X.(Y+Z)=X.Y+X.Z
(ii) X+Y.Z=(X+Y).(X+Z)
Law X.(Y+Z)=X.Y+X.Z satisfy ordinary algebra for all values, whereas X+Y.Z=(X+Y).(X+Z) satisfy only for two values (0,1)of X, Y and Z.
24.
( )
Chat generally involves one-to-one communicatio. On the other hand, video conferencing means more than two persons are involved in a discussion.
25.
( )
i)Select P_Name MAX(SAL) FROM PROGRAMMERS;
ii)UPDATE PROGRAMMERS SET SAL=SAL+2000 WHERE P_NAME LIKE "R%';
26.
( )
Value of x will be 10 because local variable hides global variable.
27.
( )
Function overloading plays very important role to implement polymorphism.It is also used to make the program run faster and reduces the number of comparison in a program.
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