BCA601QB
BCA601QB
PHP(BCA 601)
External Examination JULY 2020
QUESTION BANK
Q.19) What will be the result of combining a string with another data type in
PHP?
A. int
B. float
C. string
D. double
Ans: C
Q.30) Which one of the following property scopes is not supported by PHP?
a) friendly
b) final
c) public
d) static
Ans : A
Q.31) Which one of the following is the right way to call a class constant, given
that the class is mathFunction?
A) echo PI;
B) echo mathFunction->PI;
C) echo mathFunction::PI;
D) echo mathFunction=PI;
Ans : C
Q.32) Which of the following statements invoke the exception class?
a) throws new Exception();
b) throw new Exception();
c) new Exception();
d) new throws Exception();
Ans : B
Q.35) Which one of the following databases has PHP supported almost since the
beginning?
a) Oracle Database
b) SQL
c) SQL+
d) MySQL
Ans : D
Q.36) The updated MySQL extension released with PHP 5 is typically referred to
as _______________
a) MySQL
b) mysql
c) mysqli
d) mysqly
Ans : C
Q.38) Which method returns the error code generated from the execution of the last
MySQL function?
a) errno()
b) errnumber()
c) errorno()
d) errornumber()
Ans : A
Q.39) Which one of the following statements should be used to include a file?
a) #include „filename‟;
b) include „filename‟;
c) @include „filename‟;
d) #include <filename>;
Ans:B
Q.40) Which one of the following methods is responsible for sending the query to
the database?
a) query()
b) send_query()
c) sendquery()
d) mysqli_query()
Ans : D
Q.41) Which keyword is used to access a static method or property from within the
same class(rather than from child)?
a) static
b) strat
c) self
d) set
Ans : C
Q.43) The ........... function is used to read a single character from a file.
A) fgetc()
B) fgets()
C) fget()
D) fgetf()
Ans : A
Q,44) The ............ function checks if the "end-of-file" (EOF) has been reached.
A) f_eof()
B) f_of()
C) feofs()
D) feof()
Ans : D
A) True
B) False
Ans : A
Q.46) Which of the following is not valid PHP code?
A) $_10
B) ${“MyVar”}
C) &$something
D) $10_somethings
E) $aVaR
Ans : D
A) time()
B) date()
C) strtotime()
D) localtime()
Ans : B
A) single quotes
B) double quotes
C) both A and B
D) none of above
Ans : C
ANS:d
ANS : a
ANS : a
ANS:b
56. When you need to obtain the ASCII value of a character which of the following
function you apply in PHP?
a). chr( );
b). asc( )
c). ord( );
d). val( )
ANS : c
57. Which of the following method sends input to a script via a URL?
a). get
b). post
c). both
d). none
ANS : a
58. Which of the following function returns a text in title case from a variable?
a). ucwords($var)
b). upper($var)
c). toupper($var)
d). ucword($var)
ANS : a
59. Which of the following function returns the number of characters in a string
variable?
a). count($variable)
b). len($variable)
c). strcount($variable)
d). strlen($variable)
ANS:d
60. The practice of separating the user from the true inner workings of an
application through well-known interfaces is known as _________
a). Polymorphism
b). Inheritance
c). Encapsulation
d). Abstraction
ANS : c
74. What will be the result of combining a string with another data type in PHP?
a). int
b). float
c). string
d). double
ANS : c
90.Which one of the following PHP functions can be used to find files?
a) glob()
b) file()
c) fold()
d) get_file()
ANS : a
92.Which of the following PHP function will return true if a variable is an array or
false if it is not an array?
a) this_array()
b) is_array()
c) do_array()
d) in_array()
ANS:b
93. Which of the following function is used to get the value of the previous
element in an array?
a) last()
b) before()
c) prev()
d) previous()
ANS : c
94. The practice of separating the user from the true inner workings of an
application through well-known interfaces is known as _________
a) Polymorphism
b) Inheritance
c) Encapsulation
d) Abstraction
ANS : c
99.Which one of the following keyword is used to inherit our subclass into a
superclass?
a) extends
b) implements
c) inherit
d) include
ANS : a
A. .html
B. .xml
C. .php
D. .ph
Correct Answer : -> C
(105) Which of the following method sends input to a script via a URL?
A. Get
B. Post
C. Both
D. None
Correct Answer : -> A
A. @
B. #
C. &
D. $
A. True
B. False
C. For "sum" variable it is case-sensitive
D. None of the above
Correct Answer : -> A
(108) Variable names in PHP must start with ?
A. letter
B. underscore
C. no numbers
D. All of the above
Correct Answer : -> D
A. $_SERVER
B. $_GLOBAL
C. $_GET
D. $_POST
Correct Answer : -> B
A. header()
B. footer()
C. inset()
D. isset()
Correct Answer : -> D
A. is a browser
B. Problem arising during runtime
C. syntax error
D. is a IDE
Correct Answer : -> B
(113) Which are the two blocks that are used to check error and handle the error?
A. Do and while
B. Trying and catching
C. Try and catch
D. TryDo and Check
Correct Answer : -> C
(114) The class from which the child class inherits is called ________
i) Child class
ii) Parent class
iii) Sub class
iv) Base class
A. Only i)
B. ii), iii) and iv)
C. Only iii)
D. ii) and iv)
Correct Answer : -> D
(115) Which one of the following function is used to destroy the session?
A. session_destroy()
B. session_start()
C. session_begin()
D. begin_session()
Correct Answer : -> A
(119) If you would like to read a file character by character which function do you
use?
A. fopen ( )
B. fread ( )
C. fgetc ( )
D. file ( )
Correct Answer : -> C
(121) By default the scope of variable which is defined inside a function is?
A. Global
B. Local
C. Restricted
D. None of them
Correct Answer : -> B
(122)Which one of the following databases has PHP supported almost since the
beginning?
A. Oracle Database
B. SQL
C. SQL+
D. MySQL
Correct Answer : -> D
(123) The ________ function compares the two strings s1 and s2, ignoring the case
of the characters.
A. strtolower()
B. toLowerCase()
C. strcasecmp()
D. lc()
Correct Answer : -> C
(125) Which one of the following statements can be used to select the database?
A. $mysqli=select_db('databasename');
B. mysqli=select_db('databasename');
C. mysqli->select_db('databasename');
D. $mysqli->select_db('databasename');
Correct Answer : -> D
(126) Which one of the following statements should be used to include a file?
A. #include „filename‟;
B. include „filename‟;
C. @include „filename‟;
D. #include <filename>;
Correct Answer : -> B
(127) Which one of the following methods is responsible for sending the query to
the database?
A. query()
B. send_query()
C. sendquery()
D. mysqli_query()
Correct Answer : -> D
(128) Which one of the following method is used to retrieve the number of rows
affected by an INSERT, UPDATE, or DELETE query?
A. num_rows()
B. affected_rows()
C. mysqli_affected_rows()
D. changed_rows()
Correct Answer : -> C
A. AVG
B. CURRENT_DATE()
C. MIN
D. MAX
Correct Answer : -> B
A. DROP TABLE
B. DELETE TABLE
C. DEL TABLE
D. REMOVE TABLE
Correct Answer : -> A
A. to remove whitespaces
B. to remove lowercase alphabet
C. to remove uppercase alphabet
D. to remove underscore
Correct Answer : -> A
A. 1
B. 2
C. 3
D. 4
Correct Answer : -> B
A. echo
B. print
C. echo and print has same speed
D. None of the above
Correct Answer : -> A
A. 70
B. 80
C. 90
D. 100
Correct Answer : -> B
(138) Which one of the following function is used to send an email using PHP
script?
A. mail_send()
B. send_mail()
C. mailrr()
D. mail()
Correct Answer : -> D
(140) Which one of the following method is used to retrieve the number of
columns
A. mysql_num_fields()
B. changed_rows
C. new_rows
D. affected_rows
Correct Answer : -> A
A. xml file
B. dtd file
C. xsl file
D. Both 1 and 2
Correct Answer : -> B
A. start_session()
B. session_start()
C. session_begin()
D. begin_session()
Correct Answer : -> B
A. \d
B. /t
C. \n
D. /p
Correct Answer : -> C
(146) How should we add a single line comment in our PHP code?
A. /?
B. /@
C. //
D. /*
Correct Answer : -> C
1. <?php
2. $num = 1;
3. $num1 = 2;
4. print $num+$num1;
5. ?>
A. 3
B. 1+2
C Error
D. 12
A. Big Arrays
B. circular Arrays
C. Advance arrays
D. Associative arrays
Correct Answer : -> D
(150) An Object is a/an ________ of a class.
A. type
B. prototype
C. instance
D. object