Q: Which function is used to check whether a character is an alphabet?
Solution: Character classification provides isalpha() function to check whether a character in C++ is an alphabet or not.
Q: Which function is used to check whether a character is an alphabet or number?
Solution: Character classification provides isalnum() function to check whether a character in C++ is alphabet or number.
Q: Which function is used to check whether a character is a number?
Solution: Character classification provides isdigit() function to check whether a character in C++ is number or not.
Q: Which function is used to check whether a character is a tab or space?
Solution: Character classification provides isblank() function to check whether a character in C++ is space or tab.
Q: Which function is used to check whether a character is tab or space or whitespace control code( , ,etc.)?
Solution: Character classification provides isspace() function to check whether a character in C++ is tab or space or whitespace control code( , , etc.).
Q: Which function is used to check whether a character is tab or a control code?
Solution: Character classification provides iscntrl() function to check whether a character in C++ is tab or a control code.
Q: Which function is used to check whether a character is printable on console?
Solution: Character classification provides isprint() function to check whether a character in C++ is printable on console.
Q: Which function is used to check whether a character is hexadecimal?
Solution: Character classification provides isxdigit() function to check whether a character in C++ is hexadecimal.
Q: Which function is used to check whether a character is punctuation mark?
Solution: Character classification provides ispunct() function to check whether a character in C++ is punctuation mark.
Q: What will be the output of the following C++ code? #include#include using namespace std; int main(int argc, char const *argv[]) { char arr[12] = "Hello World"; for(int i=0;i<12;i++) { cout<<(bool)isalpha(arr[i]); } }
Solution: In this program we are checking whether a character is an alphabet or not so in “Hello World” except space everything is alphabet, therefore, we have 11111011111 but it is followed by a 0 because every string is followed by a null character which is not alphabet, therefore, we have 0 at the of the binary string.
You Have Score    | /10 |