UECS1643 Fundamentals Of ProgrammingPractical 9Answer GuidelinesPart A(Understanding Concepts)1Given the program below, answer the following questions.(a) What is the output if the input is the following?i5Alphanumeric characterDigitiiPAlphanumeric characterUppercase letteriii(Tab key)WhitespaceivgAlphanumeric characterLowercase letterv?Some other character(b) Why code ch = getchar();is usedinstead ofcin>>ch;?Because object cin cannot be used to read whitespacecharacters, for example space, tab, newline, etc. Whereas,getchar() function can read all types of characters.2Given the program below, answer the following questions.1
UECS1643 Fundamentals Of Programming(a) What is the output if the input is the following?i)htolower of h returns htoupper of h returns Hii)Ytolower of Y returns ytoupper of Y returns Yiii)3tolower of 3 returns 3toupper of 3 returns 3(b) What will be the output if a non-alphabetcharacter is sent to function tolower() or toupper() ?The tolower() or toupper() function will return back theunchanged non-alphabet as output.3The following program displays a table showing the characters from atoztogether with their ASCII codes. (a) Run the program and observe the output.2
UECS1643 Fundamentals Of Programming(b) Modify the code above to get the following output:#include <iostream>using namespace std;int main(void){char ch;cout << "Letter\tASCII Code\n";for (ch = 'Z'; ch >= 'A'; ch--)cout<<" "<<ch<<"\t " << (int)ch<< endl;return 0;}.4. s1 length: 4s2length: 43
UECS1643 Fundamentals Of Programmings1: goods2 from 2nd element: jobs1: good jobs1: good job jo5.(a) -1(b)1(c) 06.0 1 1 1 1 1-1 0 1 1 1 1-1 -1 0 1 1 1-1 -1 -1 0 1 1-1 -1 -1 -1 0 1-1 -1 -1 -1 -1 07.The following program asks the user to enter a word. The program will display the word backward. It is assumed that the word will not exceed 20 characters. The program displays the characters one by one starting from the lastcharacter. Answer the following questions:4
(a) Why header file <cstring> is included?Function strlen() requires this header file(b) What is the output if the word entered is “program” ?