The answers are 1, 3, and 5.
Answer:
c. $_SERVER
Explanation:
$_SERVER is an array in PHP containing information about headers, paths, and script locations.
Example usage:
echo $_SERVER['HTTP_HOST'];
This will print information about HTTP_HOST header.
echo $_SERVER['DOCUMENT_ROOT'];
This provides information about document root path.
echo $_SERVER['SCRIPT_FILENAME'];
This provides information about the currently executing script.
Answer:
The program to this question can be given as follows:
Program:
//class
public class factorial //defining class
{
//method fact
public static long fact(int x1) //defining method fact
{
//conditional statement
if (x1 <= 1) //if block checks parameter value less then equal to 1
{
return 1; //return value
}
else //else part
{
return (fact(x1 - 1) * (long) x1); //return factors using recursive function
}
}
//method main
public static void main(String[] args) //defining main method
{
long data=fact(5);//defining variable that holds function value
System.out.println("Factorial is: "+data); //print value
}
}
Output:
Factorial is: 120
Explanation:
In the above java program, a class is "factorial" is defined, inside the class, a static method "fact" is declared, that accepts an integer parameter that is "x1" and returns a long value, inside this method a conditional statement is used.
- If the block it checks parameter value is less then equal to 1, if this condition is true, it will return 1 when this condition is not true. It will go in else part.
- In else part, it uses a recursive function to calculate factorial of a number and return its value.
- Then the main method is defined, inside this method a long variable "data" is defined, that call and holds fact function return value, and in the next line, the print function is used to print the data variable value.
Answer:
- If a group of 9 kids have won a total of 100 trophies, then at least one of the 9 kids has won at least 12 trophies.
- If a person buys at least 400 cups of coffee in a year, then there is at least one day in which the person has bought at least two cups of coffee.
- The average of three real numbers is greater than or equal to at least one of the numbers.
Explanation:
1)
Suppose that each kid has less than 12 trophies
Total trophies = 100
Maximum trophies won by one kid = 11
total kids = 9
total number of trophies = 9 * 11 = 99 which contradicts the fact the total number of trophies are 100
2)
Suppose that person has less than 2 cups of coffee a day
Total cups of coffee = 400
he has bought at least one cup of coffee each day
which means
total number of cups of coffee = 1* 366 = 366 which contradicts the fact the person buys at least 400 cups of coffee in a year
3)
Average of three number = (a+ b+ c)/3
suppose that there are real numbers a, b, and c such that all three numbers are less than the average of the three numbers.
Let m be the average (a+b+c
)/3 = m. Then our assumption states that (a < m) and (b < m) and (c < m). By adding all the inequalities we get a + b + c < 3m. But m is defined to be (a+b+c)
/3 , so a + b + c = 3m. But now we have that 3m = a + b + c < 3m. So 3m < 3m which is an obvious contradiction. Thus our claim is true