Idk what programming language you use so
private int quarter_num(int num) {
return num / 4;
}
Answer:
Only
Option: void f1(float array[], int size);
is valid.
Explanation:
To pass an array as argument in a function, the syntax should be as follows:
functionName (type arrayName[ ] )
We can't place the size of the array inside the array bracket (arrayName[100]) as this will give a syntax error. The empty bracket [] is required to tell the program that the value that passed as the argument is an array and differentiate it from other type of value.
Answer:
# The count variable should be defined in a global scope.
count = 0
def count_users(group):
for member in get_members(group):
count += 1
if is_group(member):
count += count_users(member)
return count
print(count_users("sales")) # Should be 3
print(count_users("engineering")) # Should be 8
print(count_users("everyone")) # Should be 18
Explanation:
The count variable should be defined in a global scope which means that it shouldn't be defined inside the scope of the count_users function.
The reason is that count_users is a recursive function and when it is called recursively then it will be setting the count variable to 0 again and again, hence instead of keeping the count of users, it will lose the value all the time serving no purpose. But when it's defined outside the function then it will not initialized again in the recursive calls.