Question
click below
click below
Question
#include <iostream>
#include <ctype.h>
int main ()
{
int i=0;
char str[]="first line \n second line \n";
while (!iscntrl(str[i]))
{
putchar (str[i]);
i++;
}
r
Normal Size Small Size show me how
FA3 ComProg
Question | Answer |
---|---|
Converts lowercase letter to uppercase | toupper() |
What is the output of the given program? #include <iostream> #include <ctype.h> int main () { int i=0; char str[]="first line \n second line \n"; while (!iscntrl(str[i])) { putchar (str[i]); i++; } r | first line |
What is the output of the given program? #include <cctype> #include <iostream> #include <cstring> using namespace std; int main() { char str[] = "THIS IS A TEST"; for (int i=0; i<strlen(str); i++) putchar(tolower | this is a test |
Which of the following is a cstring function? | strcpy() |
What is the output of the given program? #include <iostream> #include <ctype.h> using namespace std; int main () { int i=0; char str[]="hello world!\n"; char c; while (str[i]) { c=str[i]; if (islower(c | HELLO WORLD! |
A function used to concatenate strings | strcat() |
Returns true if character expression is either a letter or a digit otherwise false | isalnum () |
Check if a character is blank | isblank() |
Which of the following converts string to float? | stof |
Which of the following function converts the string to an integer? | stoi |
A header file that handles string in C++ | string |
What is the output of the following program? #include <string> #include <iostream> using namespace std; int main() { string str; cin>>str; cout<<str; return 0; } | input provided by user |
The sequence of contiguous characters in memory is called _____________ | Character strings |
What is the identifier given to string class to declare string objects? | string |
What is the output of the given program? #include <iostream> #include <string> using namespace std; int main() { string s = 'a'; cout<<s; return 0; } | a |
It returns true if str is an empty string | str.empty(); |
What is the output of the given program? #include <iostream> #include <string> using namespace std; int main () { string str1 = "Hello "; string str2 = "World"; cout << ""; return 0; } | Blank output |
Which of the following is correct? | char str[80]; |
Check if a character is alphanumeric | isalnum() |
It returns the lowercase version of a character expression: | tolower() |
What is the output of the given program? #include <iostream> #include <ctype.h> int main () { int i=0; char str[]="first line "; return 0; } | blank screen |
Returns true provided character expression is a whitespace character, such as the blank or newline character, otherwise, returns false. | isspace() |
What is the output of the given program? #include <iostream> #include <string> #include <cmath> using namespace std; int main () { string s ="79"; int n = stoi(s); cout << n; return 0; } | 79 |
If two strings are identical, then the strcmp() function returns: | 0 |
The append operator is denoted by: | += |
What is the output of the given program? #include <iostream> #include <string> using namespace std; int main () { string str1 = "This is a test"; string str2 = "test"; cout << "Word is found at index " << str1.find(str2 | Word is found at index 10 |
What is the output of the given program? #include <iostream> #include <string> using namespace std; int main () { string str1 = "This is a test"; cout << str1.empty(); return 0; } | 0 |
What is the output of the following program? #include <iostream> #include <string> using namespace std; int main () { string str1 = "Hello "; string str2 = "World"; string str3; str3 = str1.append(str2); cout << s | Hello World |
What is the header file for the string class? | #include <string> |
What is the output of the following program? #include <iostream> #include <string> using namespace std; int main () { string myString = "Hello"; myString[0] = 'J'; cout << myString; return 0; } | Jello |
Compares up to num characters of the C string str1 to those of the C string str2 | strncmp() |
Returns true if the provided character expression is a printing character other than whitespace, a digit, or a letter; otherwise returns false. | ispunct() |
Returns true provided character expression is an uppercase letter otherwise it returns false | isupper() |
Returns true if character expression is a digit 0 through 9 otherwise false | isdigit() |
Which of the following is a ctype function? | isalpha () |
Which of the following is used to read a line of input? | getline() |
Which of the following function allows you to read on a character? | get() |
Check the following program #include <iostream> #include <ctype.h> using namespace std; int main () { int i; char str[]="c3po...??"; i=0; while (isalnum(str[i])) i++; cout << "The first " << i << " characters are al | 5 |
What is the output of the following program? #include <iostream> #include <string> using namespace std; int main() { string s1 = "Hello"; string s2 = "Programming"; cout<< s1 + " " + | Hello Programming! |
What is the output of the following program? #include <string> #include <iostream> using namespace std; int main() { string x = "Bad "; cout << x.append(Romance); return 0; } | Error |
What is the output of the following program? #include <string> #include <iostream> using namespace std; int main() { string x = "Bad "; cout << x.append("Liar"); return 0; } | Bad Liar |
If a = “$512” then a is a: | string |
Which of the following operator can be used also in strings? | - |