Computer Science › Method Declarations
1. class test
2. {
3. public:
4. test();
5. exams(int);
6. quiz(int);
7. private:
8. int grade;
9. }
Which line represents the constructor?
True or False.
This code snippet defines a method that takes in two strings as input and will return a boolean as a result.
public void returnBoolean (String input1, String input2);
Fill in the blank.
A ______ function does not specify a return type, but may have any number of inputs.
Write the stub for a public method named writeToConsole that takes in a boolean b and a string s that returns an integer.
Which of the following is a method that takes a string and an integer as parameters, using the integer to increase each character value in the string before returning the new value? (For instance, a 2 applied to abc should become cde.)
#include <iostream>
#include <string>
using namespace std;
``
int main() {
string name;
cout << "Tell me your name: "<<endl;
getline(cin, name);
sayHello();
``
return 0;
}
``
void sayHello(string nameToGreet){
cout << "Hello, " << nameToGreet << "!"<< endl;
}
Why would the above program fail?