• NCERT Solutions
    • NCERT Library
  • RD Sharma
    • RD Sharma Class 12 Solutions
    • RD Sharma Class 11 Solutions Free PDF Download
    • RD Sharma Class 10 Solutions
    • RD Sharma Class 9 Solutions
    • RD Sharma Class 8 Solutions
    • RD Sharma Class 7 Solutions
    • RD Sharma Class 6 Solutions
  • Class 12
    • Class 12 Science
      • NCERT Solutions for Class 12 Maths
      • NCERT Solutions for Class 12 Physics
      • NCERT Solutions for Class 12 Chemistry
      • NCERT Solutions for Class 12 Biology
      • NCERT Solutions for Class 12 Economics
      • NCERT Solutions for Class 12 Computer Science (Python)
      • NCERT Solutions for Class 12 Computer Science (C++)
      • NCERT Solutions for Class 12 English
      • NCERT Solutions for Class 12 Hindi
    • Class 12 Commerce
      • NCERT Solutions for Class 12 Maths
      • NCERT Solutions for Class 12 Business Studies
      • NCERT Solutions for Class 12 Accountancy
      • NCERT Solutions for Class 12 Micro Economics
      • NCERT Solutions for Class 12 Macro Economics
      • NCERT Solutions for Class 12 Entrepreneurship
    • Class 12 Humanities
      • NCERT Solutions for Class 12 History
      • NCERT Solutions for Class 12 Political Science
      • NCERT Solutions for Class 12 Economics
      • NCERT Solutions for Class 12 Sociology
      • NCERT Solutions for Class 12 Psychology
  • Class 11
    • Class 11 Science
      • NCERT Solutions for Class 11 Maths
      • NCERT Solutions for Class 11 Physics
      • NCERT Solutions for Class 11 Chemistry
      • NCERT Solutions for Class 11 Biology
      • NCERT Solutions for Class 11 Economics
      • NCERT Solutions for Class 11 Computer Science (Python)
      • NCERT Solutions for Class 11 English
      • NCERT Solutions for Class 11 Hindi
    • Class 11 Commerce
      • NCERT Solutions for Class 11 Maths
      • NCERT Solutions for Class 11 Business Studies
      • NCERT Solutions for Class 11 Accountancy
      • NCERT Solutions for Class 11 Economics
      • NCERT Solutions for Class 11 Entrepreneurship
    • Class 11 Humanities
      • NCERT Solutions for Class 11 Psychology
      • NCERT Solutions for Class 11 Political Science
      • NCERT Solutions for Class 11 Economics
      • NCERT Solutions for Class 11 Indian Economic Development
  • Class 10
    • NCERT Solutions for Class 10 Maths
    • NCERT Solutions for Class 10 Science
    • NCERT Solutions for Class 10 Social Science
    • NCERT Solutions for Class 10 English
    • NCERT Solutions For Class 10 Hindi Sanchayan
    • NCERT Solutions For Class 10 Hindi Sparsh
    • NCERT Solutions For Class 10 Hindi Kshitiz
    • NCERT Solutions For Class 10 Hindi Kritika
    • NCERT Solutions for Class 10 Sanskrit
    • NCERT Solutions for Class 10 Foundation of Information Technology
  • Class 9
    • NCERT Solutions for Class 9 Maths
    • NCERT Solutions for Class 9 Science
    • NCERT Solutions for Class 9 Social Science
    • NCERT Solutions for Class 9 English
    • NCERT Solutions for Class 9 Hindi
    • NCERT Solutions for Class 9 Sanskrit
    • NCERT Solutions for Class 9 Foundation of IT
  • CBSE Sample Papers
    • Previous Year Question Papers
    • CBSE Topper Answer Sheet
    • CBSE Sample Papers for Class 12
    • CBSE Sample Papers for Class 11
    • CBSE Sample Papers for Class 10
    • CBSE Sample Papers for Class 9
    • CBSE Sample Papers Class 8
    • CBSE Sample Papers Class 7
    • CBSE Sample Papers Class 6
  • Textbook Solutions
    • Lakhmir Singh
    • Lakhmir Singh Class 10 Physics
    • Lakhmir Singh Class 10 Chemistry
    • Lakhmir Singh Class 10 Biology
    • Lakhmir Singh Class 9 Physics
    • Lakhmir Singh Class 9 Chemistry
    • PS Verma and VK Agarwal Biology Class 9 Solutions
    • Lakhmir Singh Science Class 8 Solutions

Learn CBSE

NCERT Solutions for Class 6, 7, 8, 9, 10, 11 and 12

Important Questions for Class 12 Computer Science (C++) – Pointers

December 28, 2017 by Sastry CBSE

Important Questions for Class 12 Computer Science (C++) – Pointers

Previous years Examination Questions
2 Marks Questions

Question 1:
Obtain the output from the following C++ program as expected to appear on the screen after its execution. Delhi 2014
Important Note:
All the desired header files are already included in the code, which are required to run the code.

void main()
{
char*String="SARGAM"; 
int *Ptr, A[]={l,5,7,9};
Ptr=A; 
cout<<*Ptr<<String<<endl;
String++;
Ptr+=3;
cout<<*Ptr<<String<<endl;
}

Аnswer:
Output of the given program will be
1SARGAM
9ARGAM

Question 2:
Obtain the output from the following C+ + program as expected to appear on the screen after its execution. All India 2014.2013
Important Note:
All the desired header files are already included in the code, which are required to run the code.

void main()
{
char *Text = "AJANTA"; 
int *P,Num[] = {11,5,7,9};
P = Num;
cout<<*P<<Text<<endl;
Text++;
P++;
cout<<*P<<Text<<endl;
}

Аnswer:
Output of the given program will be
1AJANTA
5JANTA

Question 3:
Observe the following C+ + code carefully and obtain the output, which will appear on the screen after execution of it.
Delhi 2013
Important Note:

All the desired header files are already included in the code, which are required to run the code.

void main()
{
char *String = "SHAKTI"; 
int *Point, Value[]={10,15,70,19};
Point = Value;
cout<<*Point<<String<<endl;
String++;
Point++;
cout<<*Point<<String<<endl;
}

Аnswer:
Output of the given program will be
10SHAKTI
15HAKTI

Question 4:
Give the output of the following program segment: (Assuming, all desired header file(s) are already included). Delhi 2013C

void main()
{
float *Ptr,Points[] = {120,50,30,40,10};
Ptr=Points; 
cout<<*Ptr<<endl;
Ptr+=2;
Points[2]+=2.5; 
cout<<*Ptr<<endl:
Ptr++;
(*Ptr)+=2.5; 
cout<<Points[3]<<endl;
}

Аnswer:
Output of the given program will be
20
32.5
42.5

Question 5:
Find the output of the following program: All India 2012

#include<iostream.h> 
#include<conio.h>
#include<ctype.h> 
typedef char Str80[80]; 
void main() 
{
char *Notes;
Str80 Str="vR.zGooD";
int L=6;
Notes = Str; 
while(L>=3)
{
Str[L]=isupper(Str[L])?
tolower(Str[L]); 
toupper(Str[L]); 
cout<<Notes<<endl;
L--;
Notes++; 
getch();
}
}

Аnswer:
Output of the given program will be
vR.zGoOd
R.zGOOD
.zgOOD
ZgOOD

Question 6:
Find the output of the following program: Delhi 2012

#include<iostream.h> 
#include<conio.h>
#include<ctype.h> 
typedef char Txt80[80]; 
void main()
{
char *PText; 
Txt80 Txt="Ur2GReAt"; 
int N=6;
PText=Txt:
while(N>=3)
{
Txt[N]=isupper(Txt[N])? 
tolower(Txt[N]);
toupper(Txt[N]); 
cout<<PText<<endl;
N--;
PText++;
}
}

Аnswer:
Output of the given program will be
Ur2GReat
r2GREat
2GrEat
grEat

Question 7:
In the following program, what will be the possible output(s) from the following options (i), (ii), (iii) and (iv)? Justify your answer. Delhi 2011C

#include<iostream.h> 
#include<stdlib.h> 
#include<string.h> 
#include<conio.h> 
void main()
{
clrscr();
char *Text="1234"; 
int L=strlen(Text);
randomize(); 
for(int I=0;I<L;I++)
{
int Start=random(I)+1; 
char P=Text[Start]; 
cout<<P<<":";
}
getch();
}
(i) 1:3:2:4: 
(ii) 2:2:3:2:
(iii) 2:2:4:4: 
(iv) 2:2:2:3:

Аnswer:
The possible output will be (ii) 2:2:3:2: and (iv) 2:2:2:3:

Question 8:
Find the output of the following program : Delhi 2011

#include<iostream.h>
#include<conio.h> 
void main()
{
int Track[] = {10, 25, 30, 55},*Striker; 
Striker = Track;
Track[1] += 30;
cout<<"Striker"<<*Striker<<endl; 
*Striker -= 10;
Striker++;
cout<<"[email protected]"<<*Striker<<endl;
Striker += 2;
cout<<"[email protected]"<<*Striker<<endl; 
cout<<"Rest To"<<*Striker[0]<<endl;
}

Аnswer:
There is an error in last line, i.e. *Striker[0], so the program will not run. In case, if there is no subscript in Striker pointer, then the output would be
Striker10
[email protected]
[email protected]
Rest To55

Question 9:
Find the output of the following program: All India 2011

#include<iostream.h> 
#include<conio.h>
void main()
{
int *Queen, Moves[]={11, 22, 33,44};
Queen = Moves;
Moves[2] += 22; 
cout<<"Queen @"<<*Queen<<endl;
*Queen -= 11;
Queen += 2;
cout<<"[email protected]"<<*Queen<<endl;
Queen++;
cout<<"[email protected]"<<*Queen<<endl; 
cout<<"New [email protected]"<<*Moves[0]<<endl;
}

Аnswer:
There is an error in last line, i.e. *Moves[0], so the program will not run. In case, if there is no subscript in Moves pointer, then the output would be
Queen @11
[email protected]
[email protected]
New [email protected]

Question 10:
Find the output of the following program:

#include<iostream.h> 
#include<conio.h> 
void main()
{
int Numbers[]={2,4,8,10}; 
int *ptr = Numbers; 
for(int c=0;c<3;c++)
{
cout<<*ptr<<"@";
ptr++;
}
cout<<endl;
for(c=0:c<4:c++)
{
(*ptr) *= 2;
--ptr;
}
for(c=1:c<4;c++)
cout<<Numbers[c]<<"#";
cout<<endl;
}

Аnswer:
Output of the given program will be
[email protected]@[email protected]
8#16#20#

Question 11:
Find the output of the following program:

#include<iostream.h> 
#include<conio.h> 
void main()
{
int Array[]={4,6,10,12}; 
int *pointer = Array; 
for(int i=1;i<=3;i++)
{
cout<<*pointer<<"#";
pointer++;
}
cout<<endl; 
for(i=1;i<=4;i++)
{
(*pointer) *= 3;
--pointer;
}
for(i=l;i<5;i++)
cout<<Array[i-1]<<"@"; 
cout<<endl;
}

Аnswer:
Output of the given program will be
4#6#10#
[email protected]@[email protected]@

Question 12:
Give the output of the following program segment. (Assume, all required header files are included in the program.)

void main()
{
int a=32,*X=&a;
char ch=65, &eco=ch; 
eco+=a;
*X+=ch;
cout<<a<<','<<ch<<endl;
}

Аnswer:
Output of the given program will be
129,a

Question 13:
Identify the syntax error(s), if any, in the following program. Also, give reason for errors.

void main()
{
const int i=20;
const int *const ptr=&i;
(*ptr)++;
int j=15;
ptr=&j;
}

Аnswer:
(*ptr)++ cannot modify a const object ptr-&j cannot modify a const object.

Question 14:
Give the output of the following program segment. (Assume, all required header files are included in the program.)

void main()
{
int array[] = {2,3,4,51}; 
int *arptr=array;
int value=*arptr; 
cout<<va1ue<<'\n'; 
value=*arptr++; 
cout<<value<<'\n'; 
value=*arptr; 
cout<<value<<'\n'; 
value=*++arptr; 
cout<<value<<'\n'; 
}

Аnswer:
Output of the given program will be
2
2
3
4

Question 15:
Give the output of the following program segment. (Assume, all required header files are included in the program.)

void main()
{
char *s="GOODLUCK";
for(int x=strlen(s)-1;x>=0;x--) 
{
for(int y=0;y<=x;y++) 
cout<<s[y]; 
cout<<endl;
}
}

Аnswer:
Output of the given program will be
GOODLUCK
G00DLUC
G00DLU
GOODL
GOOD
GOO
GO
G

Question 16:
Give the output of the following program segment. (Assume, all required header files are included 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-l] 
else
NAME[x]--;
cout<<NAME<<endl;
}

Аnswer:
Output of the given program will be
a Orooile

Question 17:
Find and write the output of the following C++ program code: All India 2017
NOTE Assume all required header files are already being included in the program.

void main()
{
int *Point, Score[]={100,95,150,75,65,120};
Point=Score; 
for(int L=0;L<6;L++)
{
if((*Point)%10==0) 
*Point /= 2; 
else
*Point -= 2; 
if((*Point)%5==0) 
*Point /= 5; 
Point++;
}
for(int L=5;L>=0;L--)
cout<<Score[L]<<"*";
}

Аnswer:
Given program will give error, i.e. Multiple declaration for ‘L’
If we remove int from 2nd for loop then output will be:
12*63*73*15*93*10*

Question 18:
Find the output of the following program: Delhi 2012C

#include<iostream.h> 
void main() 
{
int Points=300; 
int *Start=&Points; 
int *End;
End=new int;
(*End)=Points-150:
Points+=100;
cout<<Points<<":"<<*Start<<endl; 
cout<<*End<<endl;
Start=End;
cout<<Points<<":"<<*Start<<endl; 
cout<<*End<<endl;
Points-=100;
*Start-=50;
cout<<Points<<":"<<*Start<<endl; 
cout<<*End<<endl; 
delete End;
}

Аnswer:
Output of the given program will be 400:400
150
400:150
150
300:100
100

Question 19:
Find the output of the following program Delhi 2009

#include<iostream.h> 
#include<conio.h> 
void main()
{
int X[]={10, 25, 30, 55, 110}; 
int *p=X; 
whi1e(*p<110)
{
if(*p%3!= 0)
*p = *p+1; 
else
*p = *p+2; 
p++:
}
for(int 1=4;I>=1;I--)
{
cout<<X[I]<<"*"; 
if(I%3 == 0) 
cout<<endl;
} 
cout<<X[0]*3<<endl;
}

Аnswer:
Output of the given program will be
110*56*
32*26*33

Question 20:
Find the output of the following program. Delhi (C) 2009

#include<iostream.h> 
#include<conio.h> 
struct score
{
int Year; 
float topper;
};
void Change(score *s, int x=20)
{
s->topper=(s->topper+25)-x; 
s->Year++;
}
void main()
{
score Arr[]={{2007, 100},{2008, 951}};
score *Point=Arr;
Change(Point, 50); 
cout<<Arr[0].Year<<"#"<<Arr[0].topper<<endl; 
Change(++Point);
cout<<Point->Year<<"#"<<Point->topper<<endl;
}

Аnswer:
Output of the given program will be
2008#75
2009#100

Question 21:
Find the output of the following program. All India 2009

#include<iostream.h>
#include<conio.h> 
void main()
{
int A[] = {10, 15, 20, 25. 30}; 
int *p = A; 
whi1e(*p<30)
{
if(*p%3!= 0)
*p = *p+2;
else
*p = *p+1;
P++;
}
for(int J=0;J<=4;J++)
{
cout<<A[J]<<"*"; 
if(J*3 == 0) 
cout<<endl;
}
cout<<A[4]*3<<endl;
}

Аnswer:
Output of the given program will be
12*
16*22*27*
30*90

Question 22:
What will be the output of the following program?

#include<iostream.h> 
#include<ctype.h>
#include<conio.h>
#include<string.h> 
void ChangeString(char Text[],int SCounter)
{
char *Ptr = Text;
int Length = strlen(Text); 
for(;Counter<Length-2;Counter+=2,Ptr++)
{
*(Ptr+Counter)=toupper(*(Ptr+Counter));
void main()
{
int Position=0;
char Message[]="Pointers Fun"; 
ChangeString(Message, Position); 
cout<<Message<<"@"<<Position;
}

Аnswer:
Output of the given program will be
PoiNteRs [email protected]

Question 23:
What will be the output of the following program?

#include<iostream.h>
#include<ctype.h>
#include<conio.h>
#include<string.h> 
void NewtextCchar String[],int &Position)
{
char *Pointer=String;
int Length=strlen(String);
for(;Position<Length-2;Position+=2,Pointer++)
{
*(Pointer+Position)=toupper(*(Pointer+Position));
}
}
void main()
{
clrscr();
int Location=0;
char Message[]="Dynamic Act";
Newtext(Message, Location);
cout<<Message<<"#"<<Location;
}

Аnswer:
Output of the given program will be
DynAmiC ACt#10

Computer ScienceImportant Questions for Computer ScienceNCERT Solutions

Filed Under: CBSE

LearnCBSE Sample Papers
  • Words by Length
  • NEET MCQ
  • Factoring Calculator
  • Rational Numbers
  • CGPA Calculator
  • TOP Universities in India
  • TOP Engineering Colleges in India
  • TOP Pharmacy Colleges in India
  • Coding for Kids
  • Math Riddles for Kids with Answers
  • General Knowledge for Kids
  • General Knowledge
  • Scholarships for Students
  • NSP - National Scholarip Portal
  • Class 12 Maths NCERT Solutions
  • Class 11 Maths NCERT Solutions
  • NCERT Solutions for Class 10 Maths
  • NCERT Solutions for Class 9 Maths
  • NCERT Solutions for Class 8 Maths
  • NCERT Solutions for Class 7 Maths
  • NCERT Solutions for Class 6 Maths
  • NCERT Solutions for Class 6 Science
  • NCERT Solutions for Class 7 Science
  • NCERT Solutions for Class 8 Science
  • NCERT Solutions for Class 9 Science
  • NCERT Solutions for Class 10 Science
  • NCERT Solutions for Class 11 Physics
  • NCERT Solutions for Class 11 Chemistry
  • NCERT Solutions for Class 12 Physics
  • NCERT Solutions for Class 12 Chemistry
  • NCERT Solutions for Class 10 Science Chapter 1
  • NCERT Solutions for Class 10 Science Chapter 2
  • Metals and Nonmetals Class 10
  • carbon and its compounds class 10
  • Periodic Classification of Elements Class 10
  • Life Process Class 10
  • NCERT Solutions for Class 10 Science Chapter 7
  • NCERT Solutions for Class 10 Science Chapter 8
  • NCERT Solutions for Class 10 Science Chapter 9
  • NCERT Solutions for Class 10 Science Chapter 10
  • NCERT Solutions for Class 10 Science Chapter 11
  • NCERT Solutions for Class 10 Science Chapter 12
  • NCERT Solutions for Class 10 Science Chapter 13
  • NCERT Solutions for Class 10 Science Chapter 14
  • NCERT Solutions for Class 10 Science Chapter 15
  • NCERT Solutions for Class 10 Science Chapter 16

Free Resources

RD Sharma Class 12 Solutions RD Sharma Class 11
RD Sharma Class 10 RD Sharma Class 9
RD Sharma Class 8 RD Sharma Class 7
CBSE Previous Year Question Papers Class 12 CBSE Previous Year Question Papers Class 10
NCERT Books Maths Formulas
CBSE Sample Papers Vedic Maths
NCERT Library

 

NCERT Solutions

NCERT Solutions for Class 10
NCERT Solutions for Class 9
NCERT Solutions for Class 8
NCERT Solutions for Class 7
NCERT Solutions for Class 6
NCERT Solutions for Class 5
NCERT Solutions for Class 4
NCERT Solutions for Class 3
NCERT Solutions for Class 2
NCERT Solutions for Class 1

Quick Resources

English Grammar Hindi Grammar
Textbook Solutions Maths NCERT Solutions
Science NCERT Solutions Social Science NCERT Solutions
English Solutions Hindi NCERT Solutions
NCERT Exemplar Problems Engineering Entrance Exams
Like us on Facebook Follow us on Twitter
Watch Youtube Videos NCERT Solutions App