|
1(a)
|
Give the difference between the type casting and automatic type
conversion. Also, give a suitable C++ code to illustrate both.
|
2
|
|||||||||
|
Ans
|
|
|
|||||||||
|
(b)
|
Which C++ header file(s) are essentially required to be included to
run/execute the following C++ source code (Note: Do not include any header
file, which is/are not required):
void main ()
{
char Text[]=”Something”;
cout <<”Remaining SMS chars:“<<160-strlen
(Text)<<endl;
}
|
1
|
|||||||||
|
(c)
|
Find the output of the following program:
#include<iostream.h>
#include<conio.h>
typedef char str80[80];
void main()
{
char *Notes;
str80 str=”vR2GooD”;
int L=6;
Notes=str;
while(L>=3)
{
str[L]=(isupper(str[L])?tolower(str[L]):
cout<<Notes<<endl;
L--;
Notes++;
}
}
|
2
|
|||||||||
|
Ans
|
|
|
|||||||||
|
(d)
|
Observe the following program and find out, which outputs out if (i)
to (iv) will not be expected from the program? What will be the minimum and
the maximum value assigned to the variable chance?
#include<iostream.h>
#include<stdlib.h>
void main()
{
randomize();
int Arr[]={9,6},N;
int Chance=random(2)+10;
for(int C=0;C<2;C++)
{
N=random(2);
cout<<Arr[N]+Chance<<”#”;
}
}
(i)9#6#
(ii)19#17#
(iii)19#16#
(iv)20#16#
|
|
|||||||||
|
Ans
|
The outputs not expected from the program are (i),(ii)and(iv)
Minimum value of chance=10
Maximum value of chance=11
|
|
|||||||||
Thursday, 25 February 2016
11th & 12th CS 2012 (Outside Delhi) Common Assignment
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment