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: 24/07/2019
Review Of C++
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.
Rewrite the following program after removing the syntactical errors,if any.Underline each correction.
#include<iostream.h>
void main()
{
struct STUDENT
{
char stu_name[20];
char stu_sex;
int stu_age=17;
}student;
gets(stu_name);
gets(stu_sex);
}
2.
Rewrite the correct code for the following program. Underline each correction
#include
structure Swimmingclub
{
int memnumber;
char memname[20]
char memtype[]="LIG";
}
void main()
{
Swimmingclub per1.per2;
cout<<"Member Number:";
cin>>memnumber.per1;
cout<<"Member Name:";
cin>>per1.membername;
per1.memtype="HIG";
per2=per1;
cin<<"Member Number:"<
3.
c^^
4.
What is the difference between #define and const? Explain with suitable example.
5.
What is the purpose of using a typedef command in C++? Explain with suitable example.
6.
Differentiate between a run-time error and syntax error. Also, give suitable examples of each in C++.
7.
Give the difference between the type casting and automatic type conversion. Also, give a suitable C++ code to illustrate both.
8.
To show the working of exit statement.
9.
To show the use of goto statement.
10.
To show the use of continue statement.
11.
To print the numbers using break statement.
12.
Write a C++ program to generate and display all the armstrong numbers between 1 and 200.
13.
Write a program in C++ to print first 10 multiples of an integer N, where N is to be entered by user:
14.
Show two different ways to declare as integer variable named intname and set its value to 15.
15.
Differentiate between an identifier and keywords.
16.
What is wrong with the following C++ statement?
long float y;
17.
How 'I' operator is different from '%' operator?
18.
Generally there are four data types, each of which can be signed or unsigned.Write names of all four data types.
1.
#include<iostream.h>
#include<stdio.h>
void main()
{
struct STUDENT
{
char stu_name[20];
char stu_sex;
int stu_age;
}student;
gets(student.stu_name);
cin>>(student.stu_sex);
}
2.
#include
#include
struct Swimmingclub
{
int memnumber;
char memname[20];
char memtype[4];
}
void main()
{
Swimmingclub per1.per2;
cout<<"Member Number:";
cin>>per1.memnumber;
cout<<"Member Name:";
cin>>per1.memname;
strcpy(per1.memtype."HIG");
per1.memtype="HIG";
per2=per1;
cout<<"Member Number:"<
cout<<"Member Name:"<
cout<<"Member Type:"<
}
3.
C^^
4.
#define preprocessor directive is used to define a macro with some value/expression, which is substituted during compilation of program. Unlike variable, it does not occupy memory. e.g.
#define Max 10
void main()
{
int arr[Max];
}
Const It is used in declaration of variable, it occupies memory to store a constant value, which once initialised cannot be changed
e.g. const int x=10;
5.
typedef keyword is used to assign alternative names to existing data types.
e.g. typedef int in;
Now, whenever we want to declare a variable of types integer, rather than using int, we can use 'in' keyword in place.
e.g. void main()
{
typedef int in;
//in is an alternetive name to int
in a=10;
cout<<a; // a is of type integer
6.
Syntax error is that when statements are wrongly written violating rules of the programming language.
e.g. Max + 2 = DMax is a syntax error as an expression cannot appear on the left side of an assignment operator.
Runtime error occurs in a program during its execution. Program execution halts when such an error is encountered.
e.g. division by zero, stack overflow, etc.
7.
Type casting It is used by the programmer to convert value of one type to another type. It is forced type conversion. It is done by putting the target datatype in parentheses before the data to be converted.
e.g. float X=(double)15/6);
Automatic type conversion It is automatically done by the compiler itself wherever required. It is implicit type conversion
e.g. float X=3;
8.
#include<iostream.h>
#include<conio.h>
#include<process.h>
void main()
{
int j;
cout<<"Enter the bit value 0, 1 "<<"\n";
cin>>j;
switch(j)
{
case 0;
cout<<"Bit value is 0"<<"\n";
case 1;
cout<<"Bit value is 1"<<"\n";
break;
default:
exit(0);
}
getch();
}
Output
Enter the bit value 0,1
0
Bit value is 0
9.
#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
10.
#include<iostream.h>
#include<conio.h>
void main()
{
int i=0;
do
{
i++;
cout<<"before the continue\n";
continue;
cout<<"after the continue, should";
cout<<"never print\n";
} while(i<3)
cout<<"after the do loop\n";
getch();
}
Output
before the continue
before the continue
before the continue
after the do loop
11.
#include<iostream.h>
#include<conio.h>
void main()
{
int i;
for(i=1; i<10; i++)
{
cout<<i<<" ";
if(i==4)
break;
}
getch();
} //Loop exit after printing 1 through 4
Output
1 2 3 4
12.
#include<iostream.h>
#include<conio.h>
void main()
{
int i,j,k,l;
clrscr();
cout<<"The armstrong numbers in between 1 and 200 are";
for(i=1;i<=200;i++)
{
k=0,j=i;
while(j!=0)
{
l=j;
k=k+1*1*1;
j=j/10;
}
if(k==i)
cout<<"\n"<<i;
}
getch();
}
13.
#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();
}
14.
( )
i) int intname;
intname=15;
ii) int intname=15;
15.
( )
An identifier is the name given by user for a unit of the program.e.g.CHK, Z2TOZ9, etc.
Keywords are the reserved words that convey a special meaning to the language compiler. e.g. auto, break, etc.
16.
( )
There is no data type as long float in C++. The double data type denotes the same, thus the statement should be
double y;
17.
( )
'I' operator used to find the quotient, whereas '%' operator used to find the remainder.
18.
( )
The four data types are : char,short, int and long.
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