Read and download free pdf of CBSE Class 12 Computer Science Revision Worksheet Set A. Students and teachers of Class 12 Computer Science can get free printable Worksheets for Class 12 Computer Science All Chapters in PDF format prepared as per the latest syllabus and examination pattern in your schools. Class 12 students should practice questions and answers given here for Computer Science in Class 12 which will help them to improve your knowledge of all important chapters and its topics. Students should also download free pdf of Class 12 Computer Science Worksheets prepared by teachers as per the latest Computer Science books and syllabus issued this academic year and solve important problems with solutions on daily basis to get more score in school exams and tests
Worksheet for Class 12 Computer Science All Chapters
Class 12 Computer Science students should refer to the following printable worksheet in Pdf for All Chapters in Class 12. This test paper with questions and answers for Class 12 will be very useful for exams and help you to score good marks
Class 12 Computer Science Worksheet for All Chapters
1. a) Write a Get1From2( ) function in C++ to transfer the content from two arrays FIRST[]
and SECOND[] to array ALL[]. The even places (0,2,4,…) of array ALL[] should get the
content from the array FIRST[] and odd places(1,3,5,…) of the array ALL[] should get
the content from array SECOND[].
Example:
If the FIRST[] array contain
30,60,90
And the SECOND[] array contain
10,50,80
The ALL[] array should contain
30,10,60,50,90,80
b) An array T[50][20] is stored in the memory along the column with each of the element occupying 4 bytes, find out the base address and address of element T[30][15], if an element T[25][10] is stored at the memory location 9800.
c) Write a function QUEDEL() in C++ to display and delete an element in a dynamically allocated Queue containing nodes of the following given structure:
struct NODE
{ int Itmemo;
char Iteamname[20];
NODE *Link; };
d) Define a function SWAPARR() in C++ to swap (interchange) the first row elements with the last row elements, for a two dimensional integer array passed as the argument of the function.
Example: If the two dimensional array contains
1. Find the output of the following programs:
i) #include<iostream.h>
#include<string.h>
#include<ctype.h>
void main( )
{
char NAME = “admiNStrAtiOn”;
for( int x=0;x<strlen(NAME);x++)
if(islower(NAME[x])
NAME[x] = toupper(NAME[x]);
else
if(isupper (NAME[x]))
if(x%2==0)
NAME[x] = NAME[x -1];
else
NAME[x]--;
cout<<NAME <<endl;
}
ii) #include<iostream.h> #include<conio.h>
#include<ctype.h>
class Metro
{
int Mno,TripNo,PassengerCount;
public:
Metro(int Tmno=1)
{
Mno=Tmno;
TripNo=0;
PassengerCount=0;
}
void Trip(int PC=20)
{
TripNo++;
PassengerCount+=PC;
}
void StatusShow()
{
cout<<Mno<<":"<<TripNo<<":"<<PassengerCount<<endl;}
} ;
void main()
{
Metro M(5),T;
M.Trip();
T.Trip(50);
M.StatusShow();
M.Trip(30);
T.StatusShow();
M.StatusShow();
}
iii) #include<iostream.h>
#include<ctype.h>
typedef char Str80[80];
void main()
{
char *Notes;
Str80 Str="vR2GooD";
int L=6;
Notes=Str;
while(L>=3)
{
Str[L]=(isupper(Str[L])?tolower(Str[L]):toupper(Str[L])) ;
cout<<Notes<<endl;
L--;
cout<<L;
Notes++;
}
}
iv) #include<iostream.h>
void main()
{
char *Text=”AJANTA”;
int *p, Num[]={1,5,7,9};
p=Num;
cout<<*p<<Text<<endl;
Text++;
p++;
cout<<*p<<Text<<endl;
}
2. a) What would be the last value of A displayed out?
#include<iostream.h>
void main( )
{ int A = 10;
while(++ A < 10)
{
cout<<A++;
}
}
b) In the following program, if the value of Guess entered by the user is 65, what will be the expected output(s) from the following options (i), (ii), (iii) and (iv)?
#include <iostream.h>
#include <stdlib.h>
void main()
{
int Guess,New;
randomize();
cin>>Guess;
for (int I=1;I<=4;I++)
{
New=Guess+random(I);
cout<<(char)New;
}
}
(i) ABBC
(ii) ACBA
(iii)ABCC
(iv) CABD
c) Observe the following program and find out, which output(s) out of (i) to (iv) will be expected from the program? What will be the minimum and the maximum value assigned to the variable Guess used in the code at the time when value of Turn is 3?
#include<iostream.h>
#include<stdlib.h>
void main( )
{
randomize( );
char Result[][10]={“GOLD”, “SILVER”, “BRONZE”};
int Getit=9, Guess;
for(int Turn=1; Turn<4; Turn++)
{
Guess=random(Turn);
cout<<Getit-Guess<<Result[Guess]<<”*”;
}
}
i) 9GOLD*9GOLD*8SILVER*
ii) 9GOLD*7BRONZE*8GOLD*
iii) 9GOLD*8SILVER*9GOLD*
iv) 9GOLD*8SILVER*8GOLD*
3. a) Write the function headers for constructor and destructor of a class Race.
b) When the object is passed to the function the copy of the object is made. Does constructor and destructor are called for the object copy?
c) Answer the questions (i) and (ii) after going through the following program: class Basketball
{ int Time;
public:
Basketball() //Function 1
{
Time = 0;
cout<<”Match commences “<<endl;
}
void Details() //Function 2
{
cout<<”Inter Section Basketball Match”<<endl;
}
Basketball(int Duration) //Function 3
{
Time = Duration;
cout<<”Another match begins now”<<endl;
}
Basketball(Basketball &M) //Function 4
{
Time = M.Duration;
Cout<<”Like Previous Match”<<endl;
}
};
(i) Which category of constructor – Function 4 belongs to and what is the purpose of using it?
(ii) Write statements that would call the member Functions 1 and 3.
d) Define a class bank to represent the bank account of a customer with the following specifications:
private members:
- name of the depositor char (20)
- account no int
- type of account ( s for saving, c for current account) char(1)
- balance amount (float)
member functions:-
- ini( ) to initialize data members
- deposit( ) to deposit money
- withdraw( ) for withdraw of money. Mony can be withdraw if minimum balance > = 1000
- display( ) to display data members
e) What is the difference between the members in private visibility mode and the members in protected visibility mode inside a class? Also, give a suitable C++ code to illustrate both.
f) Answer the questions (i) to (v) based on the following:
class PUBLISHER
{
char Pub[12];
double Turnover;
protected:
void Register();
public:
PUBLISHER();
void Enter();
void Display();
};
class BRANCH
{
char CITY[20];
protected:
float Employees;
public:
BRANCH();
void Haveit();
void Giveit();
};
class AUTHOR : private BRANCH , public PUBLISHER
{
int Acode;
char Aname[20];
float Amount;
public:
AUTHOR();
void Start();
void Show();
};
(i) Write the names of data members, which are accessible from objects belonging to class AUTHOR.
(ii) Write the names of all the member functions which are accessible from objects belonging to class BRANCH.
(iii) Write the names of all the members which are accessible from member functions of class AUTHOR.
(iv) How many bytes will be required by an object belonging to class AUTHOR?
(v) Name the type of inheritance illustrated in the above C++ code.
4. a) Observe the program segment given below carefully and answer the question that follows
class school
{private:
char name[25];
int numstu;
public:
void inschool( );
void outschool( );
int retnumstu( )
{return numstu; }
};
void modify(school A)
{ fstream INOUT;
INOUT.open(“school.dat”,ios::binary|ios::in|ios::ate);
school B;
int recread=0, found=0;
while(!found && INOUT.read((char*)&B,sizeof(B))
{ recread++;
if(A.retnumstu( )= = B.retnumstu( ))
{
__________________//missing statement
INOUT.write((char*)&A,sizeof(A));
Found=1;
}
else
INOUT.write((char*)&B,sizeof(B));
}
if(!found)
cout<<”\nRecord for modification does not exist”;
INOUT.close( );
}
If the function modify( ) is supposed to modify a record in file school.dat with the values of school A passed to its argument, write the appropriate statement for missing statement using seekp( ) or seekg( ), whichever needed, in the above code that would write the modified record at its proper place.
b) Write a function to count the number of blanks present in a text file named “PARA.TXT”.
c) Following is the structure of each record in a data file named “PRODUCT.DAT”. struct PRODUCT
{ char Prodact_Code[10];
char Product_Descriptionil[10];
int Stock;
};
Write a function in C++ to update the file with a new value of Stock. The Stock and the Product Code, whose Stock to be updated, are read during the execution of the program.
1. Answer the questions (i) and (ii) after going through the following class:
class Seminar
{
int Time;
public:
Seminar() //Function 1
{
Time=30;cout<<"Seminar starts now"<<end1;
}
void Lecture() //Function 2
{
cout<<"Lectures in the seminar on"<<end1;
}
Seminar(int Duration) //Function 3
{
Time=Duration;cout<<"Seminar starts now"<<end1;
}
~Seminar()
//Function 4
{
cout<<"Vote of thanks"<<end1;
}
};
i) In Object Oriented Programming, what is Function 4 referred as and when does it get
invoked/called?
ii) In Object Oriented Programming, which concept is illustrated by Function 1 and
Function 3 together? Write an example illustrating the calls for these functions.
2. Answer the questions (i) to (iv) based on the following:
class PUBLISHER
{
char Pub[12];
double Turnover;
protected:
void Register();
public:
PUBLISHER();
void Enter();
void Display();
};
class BRANCH
{
char CITY[20];
protected:
float Employees;
public:
BRANCH();
void Haveit();
void Giveit();
};
class AUTHOR : private BRANCH , public PUBLISHER
{
int Acode;
char Aname[20];
float Amount;
public:
AUTHOR();
void Start();
void Show();
};
(i) Write the names of data members, which are accessible from objects belonging to class AUTHOR.
(ii) Write the names of all the member functions which are accessible from objects belonging to class BRANCH.
(iii) Write the names of all the members which are accessible from member functions of class AUTHOR.
(iv) How many bytes will be required by an object belonging to class AUTHOR?
3. Write a function in C++ to merge the contents of two sorted arrays A & B into
third array C. Assuming array A and B are sorted in ascending order and the
resultant array C is also required to be in ascending order.
4. Observe the program segment given below carefully and fill the blanks marked as Statement 1 and Statement 2 using seekp() and seekg() functions for performing the required task.
#include <fstream.h>
class Item
{
int Ino;char Item[20];
public:
//Function to search and display the content from a particular record number
void Search(int );
//Function to modify the content of a particular record number
void Modify(int);
};
void Item::Search(int RecNo)
{
fstream File;
File.open("STOCK.DAT",ios::binary|ios::in);
______________________ //Statement 1
File.read((char*)this,sizeof(Item));
cout<<Ino<<"==>"<<Item<<endl;
File.close();
}
void Item::Modify(int RecNo)
{
fstream File;
File.open("STOCK.DAT",ios::binary|ios::in|ios::out);
cout>>Ino;cin.getline(Item,20);
______________________ //Statement 2
File.write((char*)this,sizeof(Item));
File.close();
}
5. Write a function in C++ to count the number of lines present in a text file "STORY.TXT".
6. Write a function in C++ to search for a BookNo from a binary file "BOOK.DAT", assuming the binary file is containing the objects of the following class.
class
{
int Bno;
char Title[20];
public:
int RBno(){return Bno;}
void Enter(){cin>>Bno;gets(Title);}
void Display(){cout<<Bno<<Title<<endl;}
};
7.Answer the questions (i) and (ii) after going through the following program:
class Match
{
int Time;
public:
Match() //Function 1
{
Time=0;
cout<<"Match commences"<<end1;
}
void Details() //Function 2
{
cout<<"Inter Section Basketball Match"<<end1;
}
Match(int Duration) //Function 3
{
Time=Duration;
cout<<"Another Match begins now"<<end1;
}
Match(Match &M) //Function 4
{
Time=M.Duration;
cout<<"Like Previous Match "<<end1;
}
};
i) Which category of constructor - Function 4 belongs to and what is the purpose
of using it?
ii) Write statements that would call the member Functions 1 and 3
Q1.Name the header file(s) that shall be needed for the following code :
void main()
{
char Text[]=”Computer Science”;
cout<<setw(20)<<Text;
}
Q2.Rewrite the following C++ program code after removing the syntax error(s) (if any) . Underline each correction.
#include<iostream.h>
class Product
{
char P_name[20];
float Rate;
Product()
{
strcpy(P_Name,"Sheet");
Rate=450;
}
public:
void Display()
{
cout<<P_Name<<":"<<Rate<<endl;
}
};
void main()
{
Product P;
Display.P();
}
Q3.Find the output of the following program code :
#include<iostream.h>
struct Box
{
int Len, Bre, Hei;
};
void Measure(Box B)
{
cout<<B.Len<<":"<<B.Bre<<":";
cout<<B.Hei<<endl;
}
void main()
{
Box B1={10,20,30},B2,B3;
++B1.Hei;
Measure(B1);
B2=B1;
++B2.Len;
B2.Bre++;
Measure(B2);
B3=B2;
B3.Hei+=5;
B3.Len-=2;
Measure(B3);
}
Q4.Find the output of the following program code:
#include<iostream.h>
#include<ctype.h>
void Mycode(char Msg[], char ch)
{
for(int I=0;Msg[I]!='\0';I++)
{
if((Msg[I]>='B')&&(Msg[I]<='G'))
Msg[I]=tolower(Msg[I]);
else
if((Msg[I]=='A')||(Msg[I]=='a'))
Msg[I]=ch;
else
if(I%2==0)
Msg[I]=toupper(Msg[I]);
else
Msg[I]=Msg[I-1];
}
}
void main()
{
char Mytext[]="HyPERActiVE";
Mycode(Mytext,'@');
cout<<"Changed Text is : "<<Mytext<<endl;
}
Q5.Study the following program and select the possible output from it . Justify your answer.
#include<iostream.h>
#include<stdlib.h>
const int first=25;
void main()
{
randomize();
int last=5,mid;
for(int cnt=1;cnt<=4;cnt++)
{
mid=first+random(last);
cout<<mid<<"*";
last--;
}
}
i. 29*26*25*28*
ii. 24*28*25*26*
iii. 29*26*24*28*
iv. 29*26*25*26*
Q6.Define a class ITEM in C++ with the following description :
Private members :
*ICode of type integer(Item Code)
*Item of type string(Item name)
*Price of type float(Price of each item)
*Qty of type integer(Quantity in stock)
*Discount of type float (Discount percentage on the item)
*A member function Disc() to calculate discount as per the following rule :
If Qty=50 Discount is 0
If 50<Qty<=100 Discount is 5%
If Qty>100 Discount is 10%
Public members:
*A constructor to assign initial values of Item with the word “NOT ASSIGNED” and other members as 0;
*A function Purchase() to allow the user to enter values for ICode , Item, Price, Qty and call function Disc() to calculate the discount.
*A function View() to allow the user to view the content of all the data members.
Q7.Consider the following and answer the questions that follow:
class CEO
{
double Turnover;
protected:
int Noofcomp;
public:
CEO();
void input(int);
void output();
};
class Director:public CEO
{
int noofemp;
public:
Director();
void INDATA();
void OUTDATA();
protected:
float funds;
};
class Manager:protected Director
{
float expenses;
public:
void Display(void);
};
1. Which constructor will be called first at the time of declaration of object of class Manager?
2. How many bytes will an object belonging to the class Manager require?
3. Name the member functions thet can be accessed by an object of class Manager?
4. Is the member function output() accessible by the objects of class Director?
Q8.Given a binary file named SPORT.DAT containing records of the following structure type.
struct Sport
{
char SportName[20];
char Participant[10][30];
};
Write a function in C++ that would read contents from the file SPORT.DAT and creates a file named FOOT.DAT copying only those records from SPORT.DAT when the game name is “Foot Ball”.
Q9. An array A[40][50] is stored in the memory along the row with each element occupying 4 bytes. Find out the base address and address of the element A[10][40] , if the element A[5][20] is stored at the address 5500 .
Q10. Write a function change() in C++ , which accepts an array of integers and its size as parameters and divide all those array elements by 10 which are divisible by 10 and multiply other array elements by 2.
Sample input:
A[0] | A[1] | A[2] | A[3] | A[4] |
10 | 6 | 15 | 30 | 12 |
Sample output:
A[0] | A[1] | A[2] | A[3] | A[4] |
1 | 12 | 30 | 3 | 24 |
1. What is an operating system? What are its functions?
2. What do you mean by utility software? Give one example.
3. What do you mean by Non-Pre emptive scheduling? Give examples
4. What do you meant by Pre emptive scheduling? Give examples.
5. What is meant by multiprogramming and multitasking?
6. Define device management.
7. Define file management.
8. What is a bus? How are they classified?
9. Convert (4A8C)16 to binary.
10. Convert 10010110101110 to hexadecimal.
11. Convert the following binary number to decimal
(a)10010 (b)101010
12. Convert the decimal no 84 to its binary equivalent.
13. Which character is automatically added to a string in C++?
14. What are the difference between a keyword and an identifier?
15. What is the input operator ”>>” and output operator “<<” called?
16. Write a program in C++ to accept marks in five subjects for a student and display the average mark.
17. Write a program in C++ to accept marks in five subjects for a student and display the average mark.
18. What is the difference between Runtime and Syntax errors?
19. What will be the character size of the following constants: ‘\a’, “\a”, “sachin\’s bat”.
20. What will be the character size of the following constants: ‘\a’, “\a”, “sachin\’s bat”.
21. What type of constants are the following: 14,011, 3.123, 0xA.
22. Given the following two definitions
Unsigned int u1=0, u2=7;
What is the result of each of the following expressions?
(a) u1&&u2 (b)u1||u2 (c)!u1 (d)!!u1
23. Given the following set of identifiers:
char ch;
short sh;
int intval;
log longval;
float fl;
Identify he datatype of the following expressions:
(a)’a’-3 (b) intval * longval - ch (c) fl + longval / sh
24. Predict and rectify errors:
int main()
{
cout<<enter the two numbers;
cin>>num>>auto;
float area= length*breadth;
cout<<area is<<area
}
25. Point out the errors in the following program
void main()
{ cout<<”Enter a number”;
cin>>no;
square=no*no
cout<<”The square is”<<square;
26. Correct the errors if any in the following expressions:
i) cout<<”a” a;
ii) cout>>”you are a fool”;
iii) int a; b ;
iv) include<conio.h>
27. Write a program in c++ to convert temperature in Celsius to Fahrenheit?
28. What output will be the following code fragment produce? Downloaded from
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 500
29. What is the result of the following expression:
a>=b&&(a+b)>a
(1) a=3,b=0 (2)a=7,b=7
30. Evaluate X=a++ + --a; if a=20 initially?
31. Write a c++ program to input two numbers and print their quotient and reminder ?
32. What data type is required for a variable to store 34000?
33. What is meant by type conversion?
34. What is meant by type promotion?
35. Program to accept three numbers and print the largest of these three numbers.
36. Write a program in c++ to check whether a given number is even or odd?
37. Write a program to calculate the factorial of an integer.
38. Write a program to print the first n natural umbers and their sum.
39. Write an alternative code for the following using switch-case construct:
char wish;
if( wish== ‘a’)
cout<< “ YOU WILL GETT 40 OUT OF 40”;
else if( wish== ‘b’)
cout<< “ MY FRIEND WILL GET 40 OUT OF 40”;
else if( wish== ‘c’)
cout<< “ TEACHER WILL NOT GIVE 40 OUT OF 40”;
else
cout<<”NO ONE WILL GET 40 OUT OF 40”;
40. Predict the out put :
i) for (int a=10;a>=0;a-=3);
cout<<a;
ii) for( int outer=1;outer<10;outer+=4)
41. Write a program to print first n natural numbers and their sum.
42. Write a program to calculate and print the roots of a quadratic equation ax2+bx+c=0.
43. Write a program to check whether a number is prime or not.
44. Write equivalent while loop for the following for loop:
int sum;
for( int i=0,sum=0;i<10;i++)
sum+=i;
cout<< sum;
Worksheet for CBSE Computer Science Class 12 All Chapters
We hope students liked the above worksheet for All Chapters designed as per the latest syllabus for Class 12 Computer Science released by CBSE. Students of Class 12 should download in Pdf format and practice the questions and solutions given in the above worksheet for Class 12 Computer Science on a daily basis. All the latest worksheets with answers have been developed for Computer Science by referring to the most important and regularly asked topics that the students should learn and practice to get better scores in their class tests and examinations. Expert teachers of studiestoday have referred to the NCERT book for Class 12 Computer Science to develop the Computer Science Class 12 worksheet. After solving the questions given in the worksheet which have been developed as per the latest course books also refer to the NCERT solutions for Class 12 Computer Science designed by our teachers. We have also provided a lot of MCQ questions for Class 12 Computer Science in the worksheet so that you can solve questions relating to all topics given in each chapter.
You can download the CBSE Printable worksheets for Class 12 Computer Science All Chapters for latest session from StudiesToday.com
There is no charge for the Printable worksheets for Class 12 CBSE Computer Science All Chapters you can download everything free
Yes, studiestoday.com provides all latest NCERT All Chapters Class 12 Computer Science test sheets with answers based on the latest books for the current academic session
CBSE Class 12 Computer Science All Chapters worksheets cover all topics as per the latest syllabus for current academic year.
Regular practice with Class 12 Computer Science worksheets can help you understand all concepts better, you can identify weak areas, and improve your speed and accuracy.