Sie sind auf Seite 1von 2

CSC128 (Fundamental of Computer Problem Solving) | Mar – Jul 2018 | Quiz 02

Name :
Group :
Matric No. : 15
Question 1

Write your answer, True or False

a) A return statement may return more than one value.

b) An actual parameter would receive a value from a formal parameter.

c) A while loop may not have iterations occur.

d) A function call may or may not have formal parameters in its statement.

A function prototype is mandatory if the function definition appears before


e)
the function call.

(5 marks)

Question 2

The program given below is a program to find the highest goals scored by the players. This
program will allow the user to enter player details until the user chooses to stop entering
details. Your task is to fill in the blanks with the most appropriate statements.

(10 marks)

Sample Input/Ouput:

Enter player name : Paul Pogba


Enter team name : Manchester United
Enter goals scored : 11
Press Y if there are more player details to enter : Y
Enter player name : Mohamed Salah
Enter team name : Liverpool
Enter goals scored : 31
Press Y if there are more player details to enter : Y
Enter player name : Willian
Enter team name : Chelsea
Enter goals scored : 25
Press Y if there are more player details to enter : Y
Enter player name : Emre Can
Enter team name : Liverpool
Enter goals scored : 10
Press Y if there are more player details to enter : *

The highest goal scored : 31

1
CSC128 (Fundamental of Computer Problem Solving) | Mar – Jul 2018 | Quiz 02

int highestGoalScore(int,int);

int main()
{
char answer,playerName[30],teamName[30];
int goalScore,yellowCard,max=0;
___(a)___ //loop starts here
{
cout << "Enter player name : ";
cin.getline(playerName,30);
cout << "Enter team name : ";
cin.getline(teamName,30);
cout << "Enter goals scored : ";
cin >> goalScore;
max = highestGoalScore(___(b)___,___(c)___);
cout << "Press Y if there are more player details to enter : ";
cin >> answer;
cin.ignore(1000,'\n');
}
___(d)___; //loop ends here
cout << "\nThe highest goal scored : " << ___(e)___ << endl;
}

___(f)___ highestGoalScore(int highest,int goal)


{
if (___(g)___ > ___(h)___)
return ___(i)___;
return ___(j)___;
}

a) f)

b) g)

c) h)

d) i)

e) j)

Das könnte Ihnen auch gefallen