1 The code cout toupper b causes a to be dis played on the s
Solution
=============================================================
1.
---------
Answer:
---------
B
--------------
Explanation:
--------------
cout<<toupper(\'b\'); converts the given character to upper case.
=============================================================
2.
---------
Answer:
---------
data type is int, and the return value for given expression is 1
--------------
Explanation:
--------------
Function prototype: int isalpha ( int c );
Given expression isalpha(\'g\'); return 1 since g is alphabet
=============================================================
3.
---------
Answer:
---------
0
--------------
Explanation:
--------------
result = isdigit(\'$\') returns 0 since $ is not a digit.
=============================================================
4.
---------
Answer:
---------
#
--------------
Explanation:
--------------
cout<<tolower(\'#\'); statement doest not effect on symbols
hence return as it is #.
=============================================================
5.
---------
Answer:
---------
\'\\0\'
--------------
Explanation:
--------------
End of the string is c++ is marked by \'\\0\' (null) character.
=============================================================
6.
---------
Answer:
---------
25
--------------
Explanation:
--------------
cin.getline(name,25) means user can give input atmost 25 of length.
=============================================================
7.
---------
Answer:
---------
22
--------------
Explanation:
--------------
char message[25] = \"Like tears in the rain\";
int length;
length = strlen(message);
total number of characters in message array is 22.
Hence length of the string is 22.
=============================================================
8.
---------
Answer:
---------
In the Gardenof Eden
--------------
Explanation:
--------------
char string1[30] = \"In the Garden\";
char string2[30] = \"of Eden\";
strcat(string1,string2); //concats string2 with string1
cout<<string1; //prints In the Gardenof Eden
=============================================================
9.
---------
Answer:
---------
ctype.h
--------------
Explanation:
--------------
Inorder to access islower and isspace ctype.h to be included in file.
=============================================================
10.
---------
Answer:
---------
A string constant must be enclosed in \"\"
A character constant must be enclosed in \'\'
--------------
Explanation:
--------------
A string constant must be enclosed in \"\"
A character constant must be enclosed in \'\'
=============================================================


