Explore topic-wise MCQs in Php.

This section includes 13 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 is true about the following line – $obj = new ImageHandler(‘/images/’, array(400, 300));?

A. This snippet sets the maximum dimensions allowed to 400 pixels wide by 300 pixels high
B. This snippet sets the minimum dimensions allowed to 300 pixels wide by 400 pixels high
C. This snippet sets the minimum dimensions allowed to 400 pixels wide by 300 pixels high
D. This snippet sets the maximum dimensions allowed to 300 pixels wide by 400 pixels high
Answer» B. This snippet sets the minimum dimensions allowed to 300 pixels wide by 400 pixels high
2.

Which function do you have to use to check whether the $path you’ve stored exists?

A. path_dir()
B. path()
C. is_dir()
D. path_dir()
Answer» D. path_dir()
3.

You use the $_SERVER superglobal and your _______ property to create your path to check.

A. $load_dir
B. $load
C. $save
D. $save_dir
Answer» E.
4.

Before you try to process the file, you need to make sure that your $err value is equivalent to _________

A. UPLOAD_ERR_OK
B. UPLOAD_NO_ERR
C. UPLOAD_ERR_NO_OK
D. UPLOAD_ERR
Answer» B. UPLOAD_NO_ERR
5.

To process the file, you need to break the array from $_FILES into individual values. You can do this using the ________ function.

A. divide()
B. list()
C. break()
D. indi()
Answer» C. break()
6.

DocBlocks are indicated by opening a comment using _________

A. /*
B. //*
C. /**
D. /*/
Answer» D. /*/
7.

To make the ImageHandler class portable you should create a separate file for it called __________

A. imagehandler.inc.php
B. images.inc.php
C. handler.inc.php
D. imghandler.inc.php
Answer» C. handler.inc.php
8.

To check whether a file was uploaded, you look in the _______ superglobal array.

A. $_FILES
B. $_DOCS
C. $_DOCUMENTS
D. $_FOLDERS
Answer» B. $_DOCS
9.

When you’re uploading files you need to set the enctype of the form to __________

A. text
B. text/file
C. multipart/form-data
D. multimedia/form-data
Answer» D. multimedia/form-data
10.

Before you can start processing images with PHP, you must first add the ability to upload images to your administrative form on ________

A. .htaccess
B. function.inc.php
C. index.php
D. admin.php
Answer» E.
11.

WHICH_ONE_OF_THE_FOLLOWING_IS_TRUE_ABOUT_THE_FOLLOWING_LINE_‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚ÀÖ¬®_OBJ_=_NEW_IMAGEHANDLER(‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚Àւ§/IMAGES/‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚ÀÖ¬•,_ARRAY(400,_300));?$#

A. This snippet sets the maximum dimensions allowed to 400 pixels wide by 300 pixels high
B. This snippet sets the minimum dimensions allowed to 300 pixels wide by 400 pixels high
C. This snippet sets the minimum dimensions allowed to 400 pixels wide by 300 pixels high
D. This snippet sets the maximum dimensions allowed to 300 pixels wide by 400 pixels high
Answer» B. This snippet sets the minimum dimensions allowed to 300 pixels wide by 400 pixels high
12.

Which function do you have to use to check whether the?#path you’ve stored exists?#

A. path_dir()
B. path()
C. is_dir()
D. path_dir()
Answer» D. path_dir()
13.

When you’re uploading files you need to set the enctype of the form to __________$

A. text
B. text/file
C. multipart/form-data
D. multimedia/form-data
Answer» D. multimedia/form-data