ch7 questions Flashcards

1
Q

Which printf conversion specifier would you use to display a floating-point number?

A

%f

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What printf statement could be used to take the input string “Happy Birthday” and output the string “**Happy”?

A

printf(“%’*7.5s”, “Happy Birthday”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

To send the output from printf to a variable instead of a browser, what alternative function would you use?

A

sprintf()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How would you create a Unix timestamp for 7:11 a.m. on May 2, 2016?

A

$timestamp = mktime(7,11,0,5,2,2016);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which file access mode would you use with open to open a file in write and read mode, with the file truncated and the file pointer at the start?

A

fopen(“file.txt”, ‘w+’);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the PHP command for deleting the file file.txt?

A

unlink(‘file.txt’);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which PHP function is used to read an entire file in one go, even from across the web?

A

file_get_contents();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which PHP superglobal variable holds the details on uploaded files?

A

$_FILES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which PHP function enables the running of system commands?

A

exec

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which of the following tag styles is preferred in HTML5: <hr> or <hr>?

A

<hr></hr>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly