Question
click below
click below
Question
Normal Size Small Size show me how
F4 ComProg
Question | Answer |
---|---|
Returns true if character expression is a digit 0 through 9 otherwise false | isdigit() |
Compares the C string str1 to the C string str2 | strcmp() |
Checks if a character is printable | isprint() |
Converts lowercase letter to uppercase | toupper() |
Check if a character is an uppercase letter | isupper() |
What is the identifier given to string class to declare string objects? | String |
What is the output of the following? #include <iostream> #include <string> using namespace std; int main () { string str1 = "Hello"; string str2 = "World"; if (str1==str2) cout << "Equal"; else co | NOT Equal |
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 |
Which operator is suitable for the concatenation function of a string class? | + operator |
What is the output of the following program? #include <iostream> #include <string> using namespace std; int main () { string str3(5, '#'); cout << str3; return 0; } | ##### |
How many members are in this structure? struct Person { char name[50]; int age; double salary; }; | 3 |
It is a collection of variables of different data types under a single name | Structure |
A keyword used to define a structure? | struct |
Can you place an array inside a structure? | Yes |
It is a block of code to perform a specific task | Function |
What is the output of the given program? #include <cctype> #include <iostream> #include <cstring> using namespace std; int main() { char str[] = "c++ programming"; for (int i=0; i<strlen(str); i++) putchar(touppe | C++ PROGRAMMING |
Which of the following is correct? | char str[80]; |
Which of the following compares two string values? | strcmp() |
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 |
It converts a numerical value to string? | to_string |
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 |
Which of the following operator can be used also in strings? | - |
The data elements in the structure are also known as what? | members |
What operator is used to access the members of a structure? | dot operator |
What is the output of the program? int main() { structure hotel { int items; char name[10]; }a; strcpy(a.name, "Neji"); a.items=10; cout << a.name; return 0; } | error |
What does struct Point arr[5]; do? | All of the mentioned |
The empty parentheses in a function means that it _______________ | doesn't have any parameters |
What is the error in the following program? #include <cstring> #include <iostream> using namespace std; int main () { char key[] = "apple"; char buffer[80]; do { cout << "Guess my favorite fruit? "; cin.getlin | Semicolon is missing |
It is a sequence of characters | String |
What is the output of the program? #include <cstring> #include <iostream> int main () { char str[80]; strcpy (str,"these "); strcat (str,"strings "); strcat (str,"are "); strcat (str,"concatenated."); puts (str); | these strings are concatenated. |
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 |
Compares up to num characters of the C string str1 to those of the C string str2 | strncmp() |
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 |
If two strings are identical, then the strcmp() function returns: | 0 |
The append operator is denoted by: | += |
Which of the following function converts a numerical value to string? | to_string |
If you have a structure named Person, how can you create a structure variable named s1 and s2? | Person s1, s2; |
Which of the following statements assigns a value to the hourlyWage member of the employee? | employee.hourlyWage = 75.00; |
Complete the code below: #include <iostream> #include <string> using namespace std; struct Person { string name; int age; double salary; }; int main() { Person s1; s1.name = "Ronel"; s | s1.salary |
You need to create an array from a structure named Students, which is correct? | Students stud[3]; |
Which of the following statements assigns a value to the age member of students? | students.age = 22; |
It is simply a function that doesn't need to return anything | Void Function |
The function body is written inside ___________ | {} |
Complete the following: struct Person { string name = "Ronel Ramos"; int age = 34; ________ salary = 70514.55; }; | double |