Explore topic-wise MCQs in Php.

This section includes 12 Mcqs, each offering curated multiple-choice questions to sharpen your Php knowledge and support exam preparation. Choose a topic below to get started.

1.

Which one of the following function reads a directory into an Array?

A. scandir()
B. readdir()
C. scandirectory()
D. readdirectory()
Answer» B. readdir()
2.

Which function is useful when you want to output the executed command result?

A. out_cmm()
B. out_system()
C. cmm()
D. system()
Answer» E.
3.

Which function sets the file filename last-modified and last-accessed times?

A. sets()
B. set()
C. touch()
D. touched()
Answer» D. touched()
4.

Which one of the following function outputs the contents of a string variable to the specified resource?

A. filewrite()
B. fwrite()
C. filewrites()
D. fwrites()
Answer» C. filewrites()
5.

Which one of the following function operates similarly to fgets(), except that it also strips any HTML and PHP tags form the input?

A. fgetsh()
B. fgetsp()
C. fgetsa()
D. fgetss()
Answer» E.
6.

Which one of the following function is capable of reading a specific number of characters from a file?

A. fgets()
B. fget()
C. fileget()
D. filegets()
Answer» B. fget()
7.

Which one of the following function is capable of reading a file into a string variable?

A. file_contents()
B. file_get_contents()
C. file_content()
D. file_get_content()
Answer» C. file_content()
8.

Which one of the following function is capable of reading a file into an array?

A. file()
B. arrfile()
C. arr_file()
D. file_arr()
Answer» B. arrfile()
9.

Which one of the following PHP function is used to determine a file’s last access time?

A. fileltime()
B. filectime()
C. fileatime()
D. filetime()
Answer» D. filetime()
10.

The filesize() function returns the file size in ___________

A. bits
B. bytes
C. kilobytes
D. gigabytes
Answer» C. kilobytes
11.

WHICH_ONE_OF_THE_FOLLOWING_FUNCTION_READS_A_DIRECTORY_INTO_AN_ARRAY??$

A. scandir()
B. readdir()
C. scandirectory()
D. readdirectory()
Answer» B. readdir()
12.

Which one of the following PHP function is used to determine a file’s last access time?$

A. fileltime()
B. filectime()
C. fileatime()
D. filetime()
Answer» D. filetime()