Answers:
1. 4
2. 4
Explaination: 1st Question:
char value must be in single quotes and string value must be in double quotes.
Ex: char x = 'm';
string y = "Peter";
1st option is wrong because char value and string value are not like the example above
2nd option is wrong because string value is enclosed in single quotes it should be enclosed in double quotes
3rd option is wrong because we can't pass data types in arguments to a function.
4th option is correct.
Explaination: 2nd Question:
1st option is wrong because nameP variable was never declared in the main function
2nd option is wrong because sexP,nameP... were never declared in the main function
3rd option is wrong because int &ageP means it holds the address so we should pass a variable to function not the value i.e 30
4th option is correct because we are the passing the required variables age, name which were already declared in the main function as an arguments to
int &ageP and string &nameP to hold their addresses.
2 COS1511 MAY/JUNE2020 SECTION A 20 MARKS Choose one option for every question. If, for example...
QUESTION 3 2 marks Suppose the following declarations appear in the nai nfunction of a C++ program: string nane, course, date; float cost; bool approved; Suppose the following calling statement appears in the nai nfunction: approveFunds("Menory enhancement", "Ell en Subi sa", date, 595.00, approved): Which of the options below is a correct function header of the function approveFunds in the main function? 1. void approveFunds(string coursep, string namep, string & dat ep, float cost P, bool & approved) 2. void...
Suppose the following declarations appear in the mainfunction of a C++ program: string name, qualification; char sex; int age, yearsExperience; If the following function header is given: void findCandidate (char sex, int & agep, string & name, int yearsExperience, string qualification) which of the options below is a correct calling statement of the function findCandidate in the main function? 1. findCandidate('m', 30, nameP, 7, "B. Curr"); 2. findCandidate (sex, age, name, yearsExperience, qualification); 3. findCandidate ('m', 30, name, 7, qualification);...