PHP chapter 2

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

If $total_months has a value of 13, what does $message contain after this if statement is executed? $years = $total_months/12; $years = number_format($years); $months = $total_months % 12: if ( $years == 0 ) { $message = $months . "months"; } else if ( $months == 0 ) { $message = $years . "years"; } else { $message = $years . "years, and " . $months . " months"; } a. 1 years, and 1 months b. 1 year, and 1 month c. 1 years d. 1 year

a. 1 years, and 1 months

_____ are used in PHP to perform mathematical calculations, such as addition. a. Arithmetic operators b. Binary operators c. Unary operators d. Bitwise operators

a. Arithmetic operators

A PHP variable name: a. is case-sensitive b. can contain special characters c. can start can be a PHP reserved word d. with a letter, a digit, or two underscores

a. is case-sensitive

How many data types are used by PHP? a. six b. nine c. eleven d. twelve

a. six

To round and format the value of a variable named $number to 3 decimal places and store it in a variable named $number_formatted, you code: a. $number_formatted = number_format($number, 3, round); b. $number_formatted = number_format($number, 3); c. $number_formatted = format_number($number, 3, round); d. $number_formatted = format_number($number, 3)

b. $number_formatted = number_format($number, 3);

What will $future_value contain after the for loop that follows has been executed one time? $years = 10; $annual_rate = 10; $future_value = 1000; $annual_rate = $annual_rate / 100;>br>for ($i = 1; $i <= $years; $i++ ) { $future_value = $future_value * (1 + $annual_rate); } a. 1000 b. 1100 c. 11000 d. 1010

b. 1100

A _____ contains a value that does not change during the course of program execution. a. variable b. constant c. function d. integer

b. constant

The equality operator consists of two _____ signs and performs a different function than the one performed by the assignment operator that consists of a single sign. a. percent b. greater than c. equal d. division

c. equal

A _____ value is a value of true or false. a. Switch b. Null c. Constant d. Boolean

d. Boolean

A(n) _____ is a positive or negative number with no decimal places. a. Variable b. exponential notation c. floating-point number d. integer

d. integer


Set pelajaran terkait

Financial Accounting: Chapter 1 Quiz

View Set

Social Studies South America Geography Review

View Set

Developmental Psych Final Exam Review

View Set

ESP 179 - Greenhouse Gas Emissions and Hazards

View Set

#351: Promulgated Forms (2017) (351PromulgatedForms2017) - FINAL EXAM

View Set

Chapter 18 Section 2 The Male Reproductive System Section 2

View Set

C795 - Cybersecurity Management II - Tactical | Pre-Assessment

View Set