NCERT Solutions for Class 12 Computer Science (C++) – Pointers
“ncert solutions for class 12 computer science pdf”, “ncert class 12 computer science c textbook pdf”, “computer science class 12 sumita arora solutions”, “ncert solutions for class 12 computer science python sumita arora”, “class 12 computer science ncert solutions”, “class 12 computer science practicals with solutions”, “cbse class 12 computer science textbook solutions python”, “ncert class 12 computer science python textbook pdf”
NCERT Solutions for Class 12 Computer Science (C++) having 14th Chapter whose Chapter wise Solution given below.
Very Short Answer Type Questions [1 mark each]
Question 1:
Write the definition of a function FixPay (float Pay[ ], int N) in C+ + , which should modify each element of the array Pay having N elements, as per the following rules :
|
Existing Salary |
Required |
|
If less than |
Add 25% in the |
|
If >=1,00,000 and |
Add 20% in the |
|
If >=2,00,000 |
Add 15% in the |
Аnswer:
Void FixPay(float
Pay[],int N)
{
for(int i=0;i<N;i++)
{
if(Pay[i]<100000)
Pay[i]+= Pay[i]*0.25;
else
if(Pay[i]<200000)
Pay[i]+= Pay[i]*0.20;
else
Pay[i]+= Pay[i]*0.15 ;
}
}
Question 2:
Write the definition of a member function INSERT() for a class QUEUE in C+ +,
to remove a product from a dynamically allocated Queue of items considering the
following code is already written as a part of the program.
Struct ITEM
{
int INO; char
INAME[20];
ITEM*Link;
};
class QUEUE
{
ITEM *R,*F;
Public:
QUEUE(){R=NULL;
F=NULL;}
void INSERT();
void DELETE();
~QUEUE();
};
Аnswer:
Void QUEUE::INSER()
{
ITEM*newitem = new
ITEM;
Cout<<“enter
item number”;
cin>>newitem →
INO;
Cout<<“Enter
item name”;
gets(newitem → INAME);
newitem → Link = NULL;
if (R==NULL)
R=F=newitem;
else
{
R → Link=newitem;
R = newitem;
}
Short Answer Type Questions-I
Question 1:
Write the output from the following C+ + program code :
#include<iostream.h>
#include<ctype.h>
void strcon(char s[])
{
for(int
i=0,l=0;s[i]!=’
