Friday, May 31, 2013

PHP MCQ Test – 1

Que.1. Use the ___________ to delete the data inside the table, and not the table itself?
A.    DEOP TABLE
B.    DELETE TABLE
C.    TRUNCATE TABLE
D.    REMOVE TABLE

Right Answer: C

Que.2. In mail($param1, $param2, $param3, $param4), the $param2 contains:
A.    The message
B.    The recipient
C.    The header
D.    The subject

Right Answer: D

Que.3. Which of the following delimiter is ASP style?
A.    <% %>
B.    <? ?>
C.    <script language=”php”></script>
D.    All of the above

Right Answer: A

Que.4. What is the purpose of basename() function in PHP?
A.    Returns the last accessed time of the file
B.    Returns the first accessed time of the file
C.    Strips of the path and returns the file name.
D.    Strips of the path the returns of the folder name.

Right Answer: C

Que.5. In PHP, fgets() is used to read a file one line at a time.
A.    TRUE
B.    FALSE

Right Answer: A

Que.6. Which of the following statement produce different output
A.    <? echo “this is php example”; ?>
B.    <P=”This is php example”;?>
C.    <?php echo “This is php example”; php?>
D.    <script language=”php”>print “This is php example”;</script>

Right Answer: C

Que.7. Which of the following data type is compound datatype supported by PHP.
A.    Array
B.    String
C.    Float
D.    Boolean

Right Answer: A

Que.8. Which of the following functions in PHP do not return a timestamp?
A.    time()
B.    date()
C.    strtotime()
D.    localtime()
E.    gmmktime()

Right Answer: BD

Que.9. Which of the following are valid float values?
A.    4.5678
B.    4
C.    7.00E+04
D.    All of the above

Right Answer: D

Que.10. Which of the following type specifier is invalid in printf() functions.
A.    %  a
B.    %  b
C.    %  c
D.    %  d

Right Answer: A

Que.11. Transactions are used to treat sets of SQL statements atomically.
A.    TRUE
B.    FALSE

Right Answer: A

Que.12. How does the identity operator ===compare two values in PHP?
A.    It converts them to common compatible data type and then compares the resulting values.
B.    It returns True only if they are both of the same type and value
C.    If the two values are strings, it performs a lexical comparison
D.    It based its comparison on the C strcmp function exclusively
E.    It converts both values to strings and compares them

Right Answer: B

Que.13. Which of the following is not an SQL aggregate function?
A.    AVG
B.    SUM
C.    MIN
D.    MAX
E.    CURRENT_DATE()

Right Answer: E

Que.14. The _____________ statement is used to delete a table in MySQL.
A.    DROP TABLE
B.    DELETE TABLE
C.    DEL TABLE
D.    REMOVE TABLE

Right Answer: A

Que.15. The ____________function parses an English textual date or time into Unix timestamp in PHP.
A.    strtodate()
B.    stroftime()
C.    strtotime()
D.    str_to_time()

Right Answer: C

Que.16. Which function(s) in PHP computes the difference of arrays?
A.    array_diff
B.    diff_array
C.    arrays_diff
D.    diff_arrays

Right Answer: A

Que.17. ______________ Returns the time of sunrise for a given day / location in PHP.
A.    datesunrise()
B.    date_sunrise()
C.    date-sunrise()
D.    date.sunrise()

Right Answer: B

Que.18. What is the difference between print() and echo() in PHP?
A.    echo can take multiple parameters where as print not
B.    print has a return value of 1 so it can be used in expressions where as echo has a void return type
C.    echo() can be used in the CLI version of PHP, while print() can’t
D.    print() can be used in the CLI version of PHP, while echo() can’t
E.    There’s no difference: both functions print out some text!

Right Answer: AB

Que.19. The ___________ function is used to read a single character from a file in PHP.
A.    fgetc()
B.    fgets()
C.    fget()
D.    fgetf()

Right Answer: A

Que.20. In PHP, which of the following(s) count elements in an array?
A.    count
B.    Sizeof
C.    Array_Count
D.    Count_array

Right Answer: AB


2 comments: