i Hope this isn't a real test
bool Mystery(int k) //int k will be how many times the while loop runs
{
int n; // this integer will be where the input function cin stores
// what the use enters in
bool flag=false; //sets it to false so if it it doesn't run it returns
//false
while (k>0) //as in the top line it'll run until k is equal to zero
{
cin>>n; //get number inputed from user
flag=flag &&(n>=0); //check if it is positive then it makes it
// true else it won't be the flag && (n>=0) it mean what
//flag equals and if n is greater or equal to 0 it says true or false
// and it combines both answers
k--; //it decrements k so it has 1 less loop to run else it'll go
//forever
}
return flag; //returns what flags is
}
HOme that was helpful.
Well that's a commented version
You can make your mind up on that one i think it's logical
The answer for 2) is D most likely since you don't need to know the George was making the functions unless he got his cat to do it.
For 3) It is D the sum is used before being initialized because usually in most cases it will definitely not be initialized to 0 it depends on what the computer did to it last and all that stuff.
I hope this was helpful