Flag this Question Question 11 pts Given the following two c-style string variab
ID: 3864368 • Letter: F
Question
Flag this Question
Question 11 pts
Given the following two c-style string variables, what will be the numeric result of the strcmp operation that follows?
char x[ ] = "Engineers";
char y[ ] = "Scientists";
int result = strcmp(x,y);
Question 21 pts
If there are no function prototypes, then the order in which the functions are defined plays the critical role in compilation without errors.
Question 31 pts
In the C++ language, a '' must be provided by the programmer when using an explicit-value constructor.
Question 41 pts
Read the following code:
#include <iostream>
using namespace std;
int a = 111;
int total = 0;
int main()
{
{
int b = 222;
{
int a = 333;
{
int b = 444;
{
total = a + b;
cout<<"Total is: "<<total<<endl;
}
}
}
}
return 0;
}
What is printed to the screen by the cout statement?
Question 51 pts
The region in a program where an identifier has meaning is known as:
Question 61 pts
The symbol '' is read as one symbol by the C compiler instead of two symbols that we see with human eyes.
Question 71 pts
To combine the contents of two c-style string variables together, which of the following commands is correct?
Question 81 pts
What does '' mean?
Question 91 pts
What does the following operation on a C++ string do?
s2 = s1.substr(2,3);
Question 101 pts
What does the following strcpy function do?
char his_name[20];
strcpy(his_name,"Barack Obama");
Flag this Question
Question 111 pts
What is the capacity of the c-style string defined by the following line of code?
char my_name[30] = "Kugimiya Rie";
Flag this Question
Question 121 pts
What is the length of the c-style string defined by the following line of code?
char motto[25] = "Henry Adams";
Flag this Question
Question 131 pts
What must every c-style string end with?
Flag this Question
Question 141 pts
When a function calls another function, what must the compiler recognize in order to compile without errors?
Flag this Question
Question 151 pts
Which of the following functions will return the length of a C++ string variable called x?
Flag this Question
Question 161 pts
Which of the following is true about the scope of a variable declared outside of the main function?
Flag this Question
Question 171 pts
Which operation copies the contents of a c-style string variable to a target c-style string variable?
Flag this Question
Question 181 pts
iostream is the name of the C++ library that allows you to use the .length() function on a string you have declared.
Flag this Question
Question 191 pts
string John = "hello"; is an example of what type of constructor?
Flag this Question
Question 201 pts
string Mary("hello"); is an example of what type of constructor?
-1Explanation / Answer
Solution: Option a, -1 is correct. As in string following case is considered when compare two strings: 0 if both strings are identical (equal) negative if the ASCII value of first unmatched character is less than second. positive integer if the ASCII value of first unmatched character is greater than second. Option a,True is correct. As If you do not have a prototype, and you call a function, the compiler will infer a prototype from the parameters you pass to the function. If you declare the function later in the same compilation unit, you'll get a compile error if the function's signature is different from what the compiler guessed. Option b, False is correct. As '