1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mind teasor questions in PHP

Discussion in 'PHP' started by shabbir, May 29, 2005.

  1. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
    Question

    Which one of the following statements do you use to display the value of a session variable?
    Choice 1
    echo {SESSION:$count};
    Choice 2
    echo %count;
    Choice 3
    echo session_get_value("count");
    Choice 4
    echo "<p>".$_SESSION["count"]."</p>";
    Choice 5
    echo $session->count;

    Question

    You are using PHP in order to create a PDF document. You need to set the current point in your new file.
    Referring to the above scenario, which one of the following functions do you use?
    Choice 1
    void pdf_continue_text(int pdfdoc, string text)
    Choice 2
    void pdf_lineto(int pdfdoc, double x, double y)
    Choice 3
    void pdf_restore (int pdfdoc)
    Choice 4
    void pdf_endpath(int pdfdoc)
    Choice 5
    void pdf_moveto(int pdfdoc, double x, double y)

    Question

    You are using PHP in order to create a PDF document. You need to set the current point in your new file.
    Referring to the above scenario, which one of the following functions do you use?
    Choice 1
    void pdf_continue_text(int pdfdoc, string text)
    Choice 2
    void pdf_lineto(int pdfdoc, double x, double y)
    Choice 3
    void pdf_restore (int pdfdoc)
    Choice 4
    void pdf_endpath(int pdfdoc)
    Choice 5
    void pdf_moveto(int pdfdoc, double x, double y)

    Question

    Which one of the following casts is a cast to double?
    Choice 1
    (real)
    Choice 2
    (string)
    Choice 3
    (object)
    Choice 4
    (array)
    Choice 5
    (int)

    Question

    Which one of the following security configuration options do you set to ensure PHP only serves files in this directory?
    Choice 1
    open_basedir
    Choice 2
    engine
    Choice 3
    auto_prepend_file
    Choice 4
    include_path
    Choice 5
    doc_root

    Question

    Which one of the following values when assigned to the parameter "max_execution" allows you to disable the maximum time of execution of a PHP script in the php.ini file?
    Choice 1
    -1
    Choice 2
    disabled
    Choice 3
    999
    Choice 4
    off
    Choice 5
    0

    Question

    Which one of the following ODBC functions returns a column number?
    Choice 1
    odbc_free_result_num
    Choice 2
    odbc_statistics_num
    Choice 3
    odbc_field_num
    Choice 4
    odbc_gettypeinfo_num
    Choice 5
    odbc_binmode_num

    Question

    $var = "PHP";
    $$var = "Rules";
    Using the above code as a reference, which one of the following is a valid variable name?
    Choice 1
    $PHP
    Choice 2
    $"Rules PHP"
    Choice 3
    $PHPRules
    Choice 4
    $PHP Rules
    Choice 5
    $Rules

    Question

    create table emp (
    emp_id int primary key,
    name varchar(255),
    dept_id int,
    mgr_id int
    );

    create table dept (
    dept_id int primary key,
    name varchar(255),
    mgr_id int
    );

    create unique index dept_u1 on dept (name);
    Referring to the sample code above, what query returns the number of employees in each department?
    Choice 1
    select d.name, count(1) as num_emp from dept d, emp e where d.mgr_id=e.mgr_id order by d.name
    Choice 2
    select d.name, count(1) as num_emp from dept d, emp e where d.dept_id=e.dept_id order by d.name
    Choice 3
    select d.name, count(1) as num_emp from dept d, emp e where d.mgr_id=e.mgr_id group by d.name
    Choice 4
    select d.name, count(1) as num_emp from dept d, emp e where d.dept_id=e.dept_id group by d.name
    Choice 5
    select d.name, count(1) as num_emp from dept d, emp e where d.dept_id=e.emp_id group by d.name

    Question

    You are concerned that an IMAP stream is not active, so you would like to program a function to check this.
    Referring to the above scenario, which one of the following functions do you use?
    Choice 1
    string imap_qprint(string text)
    Choice 2
    int imap_ping(int stream_id)
    Choice 3
    array imap_scan(int stream_id, string ref, string pattern, string content)
    Choice 4
    int imap_reopen(int stream_id, string mailbox [,int options])
    Choice 5
    int imap_popen(string mailbox, string user , string password [, int options])

    I would request anybody attempting this question please done put the spoiler directly here but if you would like to put the answers but them as attachment so that it just does not spoil the interest to crack them for some other guys.
     

Share This Page