Professional Documents
Culture Documents
Page 1 of 6
POINTER ASSIGNMENT
Computer Science
1.
4 /3
marks
questions
#include<iostream.h>
#include<conio.h>
int main( )
{
clrscr ( );
char str []= Sansum ;
char *s;
s = & str[5] 5;
while ( *s)
cout<<*s++;
cout<< \n Thanks\n;
return 0;
}
Identify the syntax error(s) , if any , in the following program. Also
give reason for errors.
Void main()
{
Page 2 of 6
b)
a) What is the output of the following program :
Char * Name = IntRneT;
for ( int x =0; x < strlen(Name); x++)
if ( islower(Name[x]))
Name[x] = toupper( Name[x]);
else
Name[x] = Name[x-1];
Puts(name );
b) Give the output of the following porgarm:
Void main( )
{
char *p = Difficult;
char c;
c= ++*p ++;
printf(%c,c);
}
c) Give the output of the following program segment.
Char * Name = a ProFiLe;
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] = tolower(Name [x-1]);
else
Name[x]-- ;
cout<<Name<<endl;
d) Give the output of the following program
Void main ( )
{
int array[ ] = { 2, 3, 4, 5 };
int * arptr = array ;
int value = * arptr ; cout<<value <<\n ;
value = * arptr++ ; cout<<value <<\n ;
value = * arptr ; cout<<value <<\n ;
Page 3 of 6
4.
Page 4 of 6
Page 5 of 6
1/2
marks
quesions
Page 6 of 6
------------------------------------