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 3 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.
test quewtsion s testkavin
2.
Evaluate the following postfix expression using a stack.Show the contains of stack after execution of each operation.
TRUE,FALSE,TRUE,FALSE,NOT,OR,TRUE,OR,OR,AND
3.
Use a stack to evaluate the following postfix expression and show the content of the stack after execution of each operation. Don't write any code. Assume as if you are using push and pop member functions of the stack.
AB-CD+E*+ (where A=5,B=3,C=5,D=4 and E=2)
4.
Evaluate the following postfix expression.Show the status of stack after execution of each operations separately.
T,F,NOT,AND,T,OR,F,AND
5.
Consider the following stack of characters, where STACK is allocated N = 8 memory cells.
STACK:A,C,D,FK,...........
Desceibe the STACK ath the end of the following operations.Here,
POP and PUSH are algorithms for deleting and addimg an element to the atack.
(a) POP(STACK,ITEM); (b) POP(STACK,ITEM);
(c) PUSH(STACK,L); (d) PUSH(STACK,P);
(e) POP(STACK,ITEM); (f) PUSH(STACK,R);
(g) PUSH(STACH,S); (h) POP(STACK,ITEM);
6.
A C++ program contains following declaration:
static int x[5]={5,20,30,50,70};
(i)what is the meaning of x?
(ii)what is the meaning of(x+2)?
(iii) what is the value of *x?
(iv) what is the value of *(x+2)?
(v) what is the value of *(x+2)?
7.
Give the output of the following program:
void main()
{
char *Text[2]={"Two","six:};
for(int C=0;C,2;c++)
{
for(int D=0;D,strlen(Text[0]);D++)
if(islower(Text[C][D]);
cout<<(char)toupper(Text[C][D]);
else
if(isupper(Text[C][D]) &&(D%2==0))
cout<<(char)tolower(Text[C][D]);
else
cout<<Text[c][d];
cout<<D<<end1;
}
}
8.
Give the output of the following program segment (assume all required header files are include in the program)
void main()
{
char *NAME="a ProFile";
for(int x=0;x<strlen(NAME);x++)
if(islower(NAME[x]));
else
if(isupper(NAME[x]))
if(x%2!=0)
NAME[x]=tolower(NAME[x-1]);
else
NAME[x]--;
cout<<NAME<<end1;
}
9.
Give the output of the following program segment.(Assume all required hedder files are included in the program).
#include<iostream.h>
void main()
{
int a=32,*X=&a;
char ch=65,&eco=ch;
eco+=a;
*X+=ch;
cout<,a<<','<<ch<<end1;
}
10.
Find the output of the following program:
#include<iostream.h>
void main()
{
int X[]={10,25,30,55,110};
int *p=X;
while(*p<100)
{
if(*p%3!=0)
*p=*p+1;
else
*p=*p+2;
p++;
}
for(int I=4;i>1;i--)
{
cout<<x[i]<<"*";
if(I%3==0)
cout<<end1;
}
cout<<X[0]*3<<end1;
}
11.
Find the output of the following program:
#include<iostream.h>
#include<ctype.h>
typedef char Txt80[80];
void main()
{
char*PText;
Txt80 Tet="Ur2GReAt";
int N=6;
PText=Txt;
while(N>=3)
{
Txt[N]=isupper(Txt[N])?tolower(Txt[N]):toupper(Tet[N]);
cout<<PText<<end1;
N--;
PText;
}
}
12.
Give the output of the following program segment:(Assume all desired header file(s) are already included)
void main()
{
float *ptr,Ponts[]={20,50,30,40,10};
Ptr=points;
cout<<*ptr<<end1;
ptr+=2;
ponits[2]+=2.5;
cout<<*ptr<<end1;
ptr++;
(*ptr)+=2.5;
cout<<points[3]<<end1;
}
13.
Rewrite the following program after removing the syntactical error(s), (if any). Underline each correction.
#include<iostream.h>
const int Multiple 3;
void main()
{
value = 15;
for( int Counter=1; Counter=<5; Counter++, value-=2)
if(value%Multiple==0)
cout<<Value*Multiple;
cout<<endl;
else
cout<<Value+Multiple<<endl;
}
14.
To illustrate the use of friend keyword.
15.
To know the use of if-else statement.
1.
2.
In the given, expression true and false are operands and AND, NOT and OR operators.
| Scanned Elements | operation | Stack Status |
| TRUE | PUSH TRUE | TRUE |
| FALSE | PUSH FALSE | TRUE,FALSE |
| TRUE | PUSH TRUE | TRUE,FALSE,TRUE |
| FALSE | PUSH FALSE | TRUE,FALSE,TRUE,FALSE |
| NOT | POP one operand NOT FALSE=TRUE PUSH TRUE |
TRUE,FALSE,tRUE,TRUE |
| OR | POP two operands Evaluate: TRUE OR TRUE=TRUE PUSH TRUE |
TRUE,FALSE,tRUE |
| TRUE | PUSH TRUE | TRUE,FALSE,TRUE,TRUE |
| OR | POP two operands Evaluate: TRUE OR TRUE=TRUE PUSH TRUE |
|
| OR | POP two operands Evaluate: FALSE OR TRUE=TRUE PUSH TRUE |
TRUE,TRUE |
| AND | POP two operands AND TRUE=TRUE PUSH TRUE |
TRUE |
Output TRUE
3.
Putting the values of the operands, We get the postfix expression as: 5,3,-,5,4,+,2,*,+
| Scanned Elements | Operation | Stack Status |
| 5 | Push | 5 |
| 3 | Push | 5,3 |
| - | Pop twice 5-3=2 Push |
2 |
| 5 | Push | 2,5, |
| 4 | Push | 2,5,4 |
| + | Pop twice 5+4=9 push |
2,9 |
| 2 | Push | 2,9,2 |
| * | Pop twice 9*2=18 Push |
2,18 |
| + | Pop twice 2+18=20 push |
20 |
Output 20
4.
given postfix Expression is:T,F,NOT,AND,T,OR,F,AND
| Scanned Elements | Operation | Stack Status |
| T | Push | T |
| F | Push | T,F |
| NOT | Pop one operand from stack NOT F=T PUSH |
T,T |
| AND | Pop two operands from stack T AND T=T |
T |
| T | push | T,T |
| OR | Pop two operands from stack T OR T=T |
T |
| F | Push | T,F |
| AND | pop two operands from stack T and F =F Push |
F |
Output F
5.
(a) STACK: A,C,D,F
{K is deleted}
(b) STACK:A,C,D
{F is deleted}
(c) STACK:A,C,D,L
{L is deleted}
(d) STACK:A,C,D,L,P
{P is deleted}
(e) STACK:A,C,D,L
{P is deleted}
(f) STACK:A,C,D,L,R
{R is deleted}
(g) STACK:A,C,D,L,R,S
{S is deleted}
(f) STACK:A,C,D,L,R
{S is deleted}
6.
Let us assume the bae adress or the starting adress of the array as
1000,i.e
x
| 5 | 20 | 30 | 50 | 70 |
1000 1002 1004 1006 1008
Here,each box is taking 2 bytes because array contains integer type varaiables and int takes 2 bytes.
(i) x represents an array of size 5 and also the base adress of array, i.e 1000.
(ii) It will increase the value of x 4 bytes,because
x+2=x+(size of unit)*2=1000+2*2=1004
(iii)*x means value at the adress contained in x[0],i.e.5.
(iv) (*x+2)=*(1000)+2
[because *(dereference operator) has higher priority than binary operators]
(v)*(x+2)=*(1000+2*2)=*(1004)=30
7.
tWO3
SIX3
8.
a Orooile
9.
129,a
10.
110*56*
32*26*33
11.
Output
Ur2GReat
r2GREeat
2GrEat
grEat
12.
Output
20
32.5
42.5
13.
#include<iostream.h>
const int Multiple =3; //Correction 1
void main()
{
int value = 15; //Correction 2
for( int Counter=1; Counter<=5; Counter++, value-=2) //Correction 3
if(value%Multiple==0)
{
cout<<Value*Multiple;
cout<<endl;
} //correction 4 else
cout<<Value+Multiple<<endl;
}
Correction 1 Multiple must be assigned a value.
Correction 2 Variable value must be declared with datatype.
Correction 3 =< Must be replace with <=.
Correction 4 Misplace else; so after if, compound statement must be enclosed with { }.
14.
#include<iostream.h>
#include<conio.h>
class Box
{
double width;
public:
friend void printWidth(Box box);
void setWidth(double wid);
} ;
void Box :: setWidth(double wid)
{
width = wid;
}
//Note: printWidth() is not a
//member function of any calss.
void printWidth(Box box)
{
/* Because printWidth() is a friend of Box, it
can directly access any number of this class*/
cout<<"Width of box "<<box.width<<end1;
}
void main()
{
Box box;
box.setWidth(10.0);
/* Use friend function to print the width*/
printWidth(box);
getch();
}
When the above code is compiled and excuted, it produces following result:
Width of box 10
15.
#include<iostream.h>
void main()
{
int code;
code =1;
if( code==1)
cout<<" The water was too warm\n"
else
cout<<" the water were all finished";
}
Output:
The water was too warm
Some of valid if-else statements are:
(i) If ((ch >= 'a') && (ch <= 'z'))
cout<<ch<<" is a lowercase letter";
cout<<ch<<" is not a lowercase letters";
(ii) if((age == 50) || (age >= 20))
cout<<" You are old";
else
cout<<" You are young";
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