hi, I need help with PHP questions Please 1. Given the following variable-initia
ID: 3877827 • Letter: H
Question
hi, I need help with PHP questions Please
1. Given the following variable-initializations:
$a = "10";
$b = 20;
$c = "A";
$d = (2+2 === 4);
2. What does the following php expression evaluate to?
$a + $b + $c + $d
a. 10
b. 11
c. 20
d. 21
e. 30
f. 31
g. "1020A1"
h. "1020ATRUE"
i. 96
3. A unit-test-case for a function involves doing three things:
(a) actually
(b) specifying what the
4. When developing unit tests, the inputs can vary from very-simple, to typical, to complex/edge-cases. In our file, what order should those tests be placed in?
a. It doesn't matter: all the unit tests will be run, so we'll find out which ones fail no matter what order we put them in.
b. Put the typical tests first, followed by the trivial and difficult test cases.
c. That way, we test the most likely real-world inputs first; the other tests are still important, but less-so.
d. First the simplest/most-trivial, then typical inputs, then difficult/borderline inputs.
e. This way, should a unit-test fail, it's easier to debug because you know the simpler tests all passed.
f. Trick question: you don't keep the trivial test-cases around (like the empty-string or an empty-array); you can delete those once you get the more complicated tests working.
g. Most complicated tests first.
h. That way, should a unit-test fail, we'll find out as soon as possible.
4. Suppose you write a function that takes in a temperature in and returns one of the three strings "ice", "water", or "steam".
Give several inputs you might write tests for.
(if you want to consider the function as taking in temperatures in , that's fine too :-)
5. Suppose we are testing a function whose input can be any string. What are three different, representative inputs we might test?
(Your answer should start and end with quote-marks -- just like strings are written in source-code.)
a. 10
b. 11
c. 20
d. 21
e. 30
f. 31
g. "1020A1"
h. "1020ATRUE"
i. 96
Explanation / Answer
Q1. Given the following variable-initializations:
$a = "10";
$b = 20;
$c = "A";
$d = (2+2 === 4);
2. What does the following php expression evaluate to?
$a + $b + $c + $d
------------------------------------------------------------------------------------------------------------------------------------------------------
Answer : (option f) 31
Explaination:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.