CBSE Class 12 Computer Science Programming In C++ Worksheet

Read and download free pdf of CBSE Class 12 Computer Science Programming In C++ Worksheet. Students and teachers of Class 12 Computer Science can get free printable Worksheets for Class 12 Computer Science Programming In C++ 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 school teachers as per the latest NCERT, CBSE, KVS 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 Programming In C++

Class 12 Computer Science students should refer to the following printable worksheet in Pdf for Programming In C++ 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 Programming In C++

 

Question. What are the limitations of Procedural Programming ?
Answer : Limitation of Procedural Programming Paradigm
1. Emphasis on algorithm rather than data.
2. Change in a datatype being processed needs to be propagated to all the functions that use the same data type. This is a time consuming process.
3. The procedural programming paradigm does not model real world very well.

Question. Define Class.
Answer : A Class represents a group of objects that share common properties and relationships.
Exp:- Class ab
{
statements;
}
ab obj;
Class name is ab
{ } are used to write statements with in it
; is termination symbol of the statement
obj is the object of a Class to access the data members of the class

Question. What are the features of OOP ?
Answer : Features of OOP
1. Data Abstraction
Abstraction refers to the act of representing essential features without including the background details or explanations (i.e. Hiding of Data)
2. Encapsulation
The wrapping up of data and functions (that operate on the data) into a single unit (called class) in known as Encapsulation. As a base Encapsulation is a way to implement data abstraction.
3. Modularity
The act of dividing a complete program into different individual components (functions) is called modularity. It is a property of a system that has been decomposed into a set of cohesive and loosely coupled modules
4. Inheritance
Inheritance is the capability of one class of things to inherit the features or data members or properties from another class.
The Class whose properties of data members are inherited, is called Base Class or Super Class and the class that inherits these properties, is called Derived Class or Sub Class.
Exp:- If Class A inherits the data of Class B then we can say A is Sub Class and B is Super Class.
5. Polymorphism
Polymorphism is the ability for a message or data to be processed in more than one form. Polymorphism (overloading) is the property by which the same message can be
sent to objects of several different classes. In which the same operation is performed differently depending upon the data type it is working upon.

Question. What is the difference between keyword and identifier?
Answer : Keyword is a special word that is reserved in C++ and having special meaning and purpose goto, struct, else, break etc.
Identifier is the user defined name given to a part of a program (variable name)

Question. Describe different types of operators in C++.
Answer : Operators ( to perform some computational operations or to perform some specific actions)
In C++ operators are divided into following categories:-
(Airthmatic, I/O, Increment/ Decrement, Relational & Logical Operators)
(a) I / O operators             (Input /Output Operators)
Input Operator (>>) is used to read a value from standard input.
cin object is used for taking input from the user
Example :-             int a;
                             cin>>a;             (we can input integer value)
Output Operator(<<) is used to direct a value to standard output.
cout object is used for taking output on the display device.
Example:-             int a;
                           cin>>a;
                           cout<<a;
The multiple use of input or output operators in one statement is called cascading of I/O operators
            like :             cin>>a>>b;
                                cout<<a<<b;
(b) Arithmetic Operators
            +, - , * , / and %
(c) Increment/ Decrement Operators
Increment Operator (++)
Decrement Operator (- -)
We can use both the operators in postfix and prefix mode as per the requirements in the program statement
example:- postfix         prefix
int a=10;                    int a=10;
a++;                          ++a;
cout<<a;                    cout<<a;
output is a=10             a=11
Note:- The postfix form of ++, --, operators follows the rule use-then change.
The prefix form follows the rules change then use
(d) Relational Operators
            < , <= , = = , > , >= and !=
(e) Logical Operators
            logical OR (||) , logical AND (&&) , logical NOT(!)
(f) Conditional Operator ( ? , : )
C++ offers a conditional operator ( ? : ) that stores a value depending upon a condition. This operator is ternary operator.
Syntax: -        expression1 ? expression2 : expression3
Exp:-             int result;
                     Result = marks>= 50 ? ‘P’ : ‘F’ ;
(g) Some other operators (sizeof)
sizeof num                // (num is variable name)
sizeof (type)             // (c++ data type)
(h) Assignment Operator (=)
Example:
            int total , item;
            total = total + item;
            total + =item;

Question. What is the use of main function ?
Answer : Use of Main function in C++
Main ( ) is used to compile and execute the program code of C++ it is used with standard library and header files of the OOPS Program
Example
int main ( ) // return values with its parameters
void main ( ) // not return any value not return keyword is used
void main (parameter) // at the end of the only return keyword is
                                // used except parameters

Question. What are the different data types in C++ ?
Answer : C++ Data types
Data types are means to identify the type of data and associated operations for handling it.
C++ data types are of two types
(i) Fundamental Data Types
(ii) Derived Data Types
(i) Fundamental Data Types
Fundamental Data Types are those that are not composed of other data types. There are five fundamental data types in C++: Char, int, float, double & void that represents character, integer, float.
(ii) Derived Data Type
(a) Array: It is a set of homogeneous values under one name (similar data elements). Array can be one dimensional, two dimensional or multi dimensional
Syntax:- datatype arrname [ size]             // Single dimensional
The data type of array elements is known as the Base Type of the array. An ARRAY is a collection of variables on the same type that are referenced by a common name.

Question. Explain Two dimensional array with an example.
Answer : Declaration of Two Dimensional Arrary
Syntax : - datatype arrname [size] [size]             // Two dimensional
Example:-             int num[2][5]             (array will execute 2 x 5 = 10 times)
int main( )
{
int sales [5][5];
int i,j, total ;
for (i=0; i<5, i++)
{
            total =0;
            cout<< “\n”; \\(escape sequence)
for (j=0 ; j< 5; j ++)
{
            cin>>sales[i][j];
            total =total + sales [i][j];
}
cout<< “ sales is = ”<< total;
}
return 0;
}

Question. What are functions ? Give syntax to define a function.
Answer : Functions
A function is a named unit of a group of program statements. This unit can be invoked from other parts of the program. A function return values and numbers and arguments as per instructions stored in a function
Syntax
            type function-name (parameter list)
            {
            body of the function
            }
            if type of a function is declared then it return values

Question. Define Pointer, Reference and Constant .
Answer : Pointer: A pointer is a variable that holds a memory address. This address is usually the location of another variable in memory.
Reference: A reference is an alternative name for an object. A reference variable provides an alias for a previously defined variable.
Constant: to declare constant value
Syntax :- const datatype var_name= value;
const int num =10;

Question. Explain any two user defined data types.
Answer : User defined derived data types
Class: A class represents a group of similar objects. A class describes all the properties of a data type and an object is an entity created according to that description
                  class cls_name
            {
                  statement
            };
Structure: A structure is a collection of variables of different data types referenced under one name. Variables defined under structure called with the help of structure object. struct keyword is used to define structure
struct stru_name
            {
                     type varname;
                     type varname;
            };
stru_name obj_name;
cin>>obj_name.varname;
cout<<obj_name.varname;

Question. What do you mean by variable ?
Answer : Variables: Variables represent named storage locations whose values can be manipulated

Question. What are the different types of errors in C++.
Answer : Types of errors in C++
Errors may be made during program creation even by experienced programmers. Such types of error are detected by the compiler. Debugging means removing the errors.
The errors are categorized in four types:-
(i) Syntax errors
(ii) Linking errors
(iii) Execution –time errors (Run Time errors)
(iv) Logical errors

Question. Write the C++ equivalent expressions for the following.
Volume = 3 .1459r2 h/3

Answer : Volume = 3.1459*r*r*h/3;

Question. Find the syntax error (s) if if any, in the following program:
#include<iostream.h>
int main()
int x;
cin<< x;
for(int y = 0; y < 10; y++)
cout >> x+y;

Answer : The syntax error are:
1. illegal`<<` operator in cin statement.
2. illegal`>>` operator in cout statement., return value function.

Question. differentiate between a run-time error and syntax error. Give one example of each.
Answer : While execution, a compiled program may not behave properly because of some errors called run time errors. For example, divide by zero is a run time error. The following program segment will generate such an error.The following program segment will generate such an error
while flag
   {
.
            b = b-1 ;
            term = a/b;
.
   }
Array indicates out of bound, and range errors are other examples of run time errors. A syntax error, on the other hand, is because of misuse of a programming language. Any violation of a grammatical rule of a programming language will produce a syntax error. Such errors are caught by language compiler. The following statement is not systactically correct as far as c++ is concerned .
X= y + z** E;

Question. What is the difference between an object and a class?
Answer : An object is an identifiable entity with some characteristics and behaviour. It represents an entity that can store data and its associated functions.
A class is a group of objects that share common properties and relationships

Question. Write a program to input any number and print in reverse order
Answer : in this program the number is input by user
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,s=0;
cout<<" enter the number:- ";
cin>>n;
while(n>0)
{
s=s*10+n%10;
n=n/10;
}
cout<<"revese="<<s;
getch();
}

Question. Write a program for decalring and calling of function inside main and defining outside the main ()
Answer : #include<iostream.h>
#include<conio.h>
void main()
{
void fact();
fact();
getch();             // for freeze the montior
}
void fact()
{
int i=1,n,fact=1;
cout<<"enter the number=";
cin>>n;
while(i<=n)
{
fact=fact*i
i++;
}
cout<<"fact="<<fact;
getch();
}

Question. Swapping of two numbers using function call by value & call by reference.
Answer : Call by value
            #include<iostream.h>
            #include<conio.h>
            main()
            {
            clrscr();
            int a,b;
            cout<<"enter the number=";
            cin>>a>>b;
            void swap(int,int);
            swap(a,b);
            cout<<"A="<<a<<endl;
            cout<<"B="<<b;
            getch();
            }
            void swap(int a,int b)
            {
            int t=a;
            a=b;
            b=t;
            cout<<a<<b;
            }
Call by reference
#include<iostream.h>
#include<conio.h>
void main()
{
void swap( int &a, int &b);             //prototype of a function
int num1,num2;
clrscr();
cout << “ enter both numbers: num1 & num2:”;
cin>>num1;
cout<< “\n”;
cin>>num2;
cout<< “\n Before swapping numbers are \n”;
cout<< “ num1= ”<<num1;
cout<< “\n”;
cout<< “ num2= ”<<num2;
cout<< “\n”;
swap(num1,num2);             //calling of function
cout<< “\n After swapping numbers are \n”;
cout<< “ num1= ”<<num1;
cout<< “\n”;
cout<< “ num2= ”<<num2;
cout<< “\n”;
getch( ); //for freeze the monitor
}
            void swap(int &a, int &b)             //function definition
{
int temp=a;
a=b;
b=temp;
}

Question. Name the header files of following built in functions :
Strcpy(), strcat(),log(), clrscr(),setw(),fabs(),isalnum(),isupper()

Answer : Strcpy()          string.h
Strcat()                  string.h
log()                      math.h
clrscr()                   conio.h
setw                      iomanip.h
fabs()                    math.h
isalpnum()            ctype.h
isupper()              ctype.h

More Worksheets for Class 12 Computer Science
CBSE Class 12 Computer Science Arrays Stacks Queues And Linked List Worksheet Set A
CBSE Class 12 Computer Science Arrays Stacks Queues And Linked List Worksheet Set B
CBSE Class 12 Computer Science Arrays Worksheet
CBSE Class 12 Computer Science Boolean Algebra Worksheet Set A
CBSE Class 12 Computer Science Boolean Algebra Worksheet Set B
CBSE Class 12 Computer Science C++ Programming Worksheet
CBSE Class 12 Computer Science Case Study Based Questions
CBSE Class 12 Computer Science Class And Objects Worksheet Set A
CBSE Class 12 Computer Science Class And Objects Worksheet Set B
CBSE Class 12 Computer Science Classes Objects Constructors And Destructors Worksheet
CBSE Class 12 Computer Science Communication And Network Concepts Worksheet
CBSE Class 12 Computer Science Computer Networking Worksheet
CBSE Class 12 Computer Science Constructors And Destructors Worksheet
CBSE Class 12 Computer Science Data File Handling Worksheet
CBSE Class 12 Computer Science Database Concepts And Sql Worksheet
CBSE Class 12 Computer Science Dbms And Structured Query Language Worksheet
CBSE Class 12 Computer Science Flow Of Control Worksheet
CBSE Class 12 Computer Science Function Overloading Worksheet
CBSE Class 12 Computer Science Function And Structures Worksheet
CBSE Class 12 Computer Science Inheritance Extending Classes Worksheet
CBSE Class 12 Computer Science Linked Lists Stacks And Queues Worksheet
CBSE Class 12 Computer Science Network And Communication Technology Worksheet
CBSE Class 12 Computer Science Object Oriented Programming In C++ Worksheet
CBSE Class 12 Computer Science Object Oriented Programming Worksheet
CBSE Class 12 Computer Science Oop Classes And Objects Worksheet
CBSE Class 12 Computer Science Pointer Worksheet
CBSE Class 12 Computer Science Program List Worksheet
CBSE Class 12 Computer Science Programming In C++ Worksheet
CBSE Class 12 Computer Science Revision Worksheet Set A
CBSE Class 12 Computer Science Revision Worksheet Set B
CBSE Class 12 Computer Science Revision Worksheet Set C
CBSE Class 12 Computer Science SQL Worksheet Set A
CBSE Class 12 Computer Science SQL Worksheet Set B
CBSE Class 12 Computer Science Stacks Queues And Linked List Worksheet
CBSE Class 12 Computer Science Sure Shot Questions Worksheet Set A
CBSE Class 12 Computer Science Sure Shot Questions Worksheet Set B
CBSE Class 12 Computer Science Sure Shot Questions Worksheet Set C
CBSE Class 12 Computer Science Sure Shot Questions Worksheet Set D
CBSE Class 12 Computer Science Text Files Worksheet
CBSE Class 12 Computers Boolean Algebra Worksheet
CBSE Class 12 Computers Classes And Objects Worksheet
CBSE Class 12 Computers Constructors And Destructors Worksheet
CBSE Class 12 Computers Data Structures Worksheet
CBSE Class 12 Computers Files Worksheet
CBSE Class 12 Computers Inheritance Worksheet Set A
CBSE Class 12 Computers Inheritance Worksheet Set B
CBSE Class 12 Computers Networking Worksheet
CBSE Class 12 Computers Object Oriented Programming Worksheet
CBSE Class 12 Computers Pointers Worksheet

More Study Material

CBSE Class 12 Computer Science Programming In C++ Worksheet

We hope students liked the above worksheet for Programming In C++ 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. Studiestoday is the best portal for Class 12 students to get all the latest study material free of cost.

Worksheet for Computer Science CBSE Class 12 Programming In C++

Expert teachers of studiestoday have referred to the NCERT book for Class 12 Computer Science to develop the Computer Science Class 12 worksheet. If you download the practice worksheet for one chapter daily, you will get higher and better marks in Class 12 exams this year as you will have stronger concepts. Daily questions practice of Computer Science worksheet and its study material will help students to have a stronger understanding of all concepts and also make them experts on all scoring topics. You can easily download and save all revision worksheet for Class 12 Computer Science also from www.studiestoday.com without paying anything in Pdf format. 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

Programming In C++ worksheet Computer Science CBSE Class 12

All worksheets given above for Class 12 Computer Science have been made as per the latest syllabus and books issued for the current academic year. The students of Class 12 can be rest assured that the answers have been also provided by our teachers for all worksheet of Computer Science so that you are able to solve the questions and then compare your answers with the solutions provided by us. 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. All study material for Class 12 Computer Science students have been given on studiestoday.

Programming In C++ CBSE Class 12 Computer Science Worksheet

Regular worksheet practice helps to gain more practice in solving questions to obtain a more comprehensive understanding of Programming In C++ concepts. Worksheets play an important role in developing an understanding of Programming In C++ in CBSE Class 12. Students can download and save or print all the worksheets, printable assignments, and practice sheets of the above chapter in Class 12 Computer Science in Pdf format from studiestoday. You can print or read them online on your computer or mobile or any other device. After solving these you should also refer to Class 12 Computer Science MCQ Test for the same chapter.

Worksheet for CBSE Computer Science Class 12 Programming In C++

CBSE Class 12 Computer Science best textbooks have been used for writing the problems given in the above worksheet. If you have tests coming up then you should revise all concepts relating to Programming In C++ and then take out a print of the above worksheet and attempt all problems. We have also provided a lot of other Worksheets for Class 12 Computer Science which you can use to further make yourself better in Computer Science

Where can I download latest CBSE Printable worksheets for Class 12 Computer Science Programming In C++

You can download the CBSE Printable worksheets for Class 12 Computer Science Programming In C++ for latest session from StudiesToday.com

Can I download the Printable worksheets of Programming In C++ Class 12 Computer Science in Pdf

Yes, you can click on the links above and download Printable worksheets in PDFs for Programming In C++ Class 12 for Computer Science

Are the Class 12 Computer Science Programming In C++ Printable worksheets available for the latest session

Yes, the Printable worksheets issued for Class 12 Computer Science Programming In C++ have been made available here for latest academic session

How can I download the Class 12 Computer Science Programming In C++ Printable worksheets

You can easily access the links above and download the Class 12 Printable worksheets Computer Science Programming In C++ for each chapter

Is there any charge for the Printable worksheets for Class 12 Computer Science Programming In C++

There is no charge for the Printable worksheets for Class 12 CBSE Computer Science Programming In C++ you can download everything free

How can I improve my scores by solving questions given in Printable worksheets in Class 12 Computer Science Programming In C++

Regular revision of practice worksheets given on studiestoday for Class 12 subject Computer Science Programming In C++ can help you to score better marks in exams

Are there any websites that offer free test sheets for Class 12 Computer Science Programming In C++

Yes, studiestoday.com provides all latest NCERT Programming In C++ Class 12 Computer Science test sheets with answers based on the latest books for the current academic session

Can test papers for Class 12 Computer Science Programming In C++ be accessed on mobile devices

Yes, studiestoday provides worksheets in Pdf for Programming In C++ Class 12 Computer Science in mobile-friendly format and can be accessed on smartphones and tablets.

Are worksheets for Programming In C++ Class 12 Computer Science available in multiple languages

Yes, worksheets for Programming In C++ Class 12 Computer Science are available in multiple languages, including English, Hindi