Let's Check our PHP & MySql Knowledge - PHP Quiz

Let’s do a PHP Quiz.

  • When you write a computer program, you often must execute different sets of ____, depending on some predetermined criteria.
    [/list][list=1]
  • functions
  • variables
  • autoglobals
  • statements
                                                       [color=#000000][font=Times New Roman]

[list]
[*]To open a connection to a MySQL database server, use __
[/list][/font][/color]

  1. mysqli_connect()
  2. open_connect()
  3. connection_mysqli()
  4. open_mysqli()
                                                       [color=#000000][font=Times New Roman]

[list]
[*]PHP is a(n) ____ programming language
[/list][/font][/color]

  1. strictly typed
  2. variably typed
  3. loosely typed
  4. primitively typed
                                                       [color=#000000][font=Times New Roman]

[list]
[*]The ____ portion of the SELECT statement determines which fields to retrieve from a table
[/list][/font][/color]

  1. attribute
  2. criteria
  3. command
  4. field

[color=#000000][font=Times New Roman]

[list]
[]The ____ function allows you to iterate through all the rows in a resultset.
[/list][/font][/color][list=1]
[
]mysqli_fetch_assoc()
[]mysqli_fetch_row()
[
]mysqli_fetch_array()
[*]mysqli_fetch_lengths()
[/list]More Questions to come when these are answered. Just to let you know, i don’t know the exact answers as i am learning php.

Your last question there has multiple correct responses from your list of options - I can iterate through the rows in a result set with all but 1 of those!

i don’t know about that, You can answer other questions.

1: 4, statements
2: 1, mysqli_connect() (Not the only way to do it…)
3: 3, loosely typed
4: Honestly, I don’t know the terminology you’re using here; I can write a SELECT statement and get virtually anything I want, and I can point to any SELECT statement and tell you what columns are being queried, but as far as the semantics of what part is called what… if I had to guess I’d say 3, command.
5: 1, 2, and 3 are all possible methods

Some More Questions

[color=#000000][font=Times New Roman]

  • What function gets the current working directory?
    [/list][/font][/color]
    [list=1]
  • chdir(directory)
  • chroot(directory)
  • closedir($handle)
  • getcwd()
                                       [color=#000000][font=Times New Roman]
  • You can access the values submitted from the form by using the $_GET and ____ autoglobals.
    [/list][/font][/color]
    [list=1]
  • $_POST[]
  • $_FIND[]
  • $_RETRIEVE[]
  • $_SEND[]
                                                       [color=#000000][font=Times New Roman]
  • The array_push ____ one or more elements to the end of the array
    [/list][/font][/color]
    [list=1]
  • adds
  • deletes
  • moves
  • pushes
                                                       [color=#000000][font=Times New Roman]
  • A ____ database stores information across multiple related tables
    [/list][/font][/color]
    [list=1]
  • hierarchical
  • network
  • relational
  • flat-file
                                                       [color=#000000][font=Times New Roman]

[list]
[]The ____ function performs a case-sensitive search and returns the position of the last occurrence of one string in another string
[/list][/font][/color]

[list=1]
[
]soundex()
[]strrpos()
[
]stripos()
[*]stristr()
[/list] [color=#000000][font=Times New Roman]

[/font][/color] [color=#000000][font=Times New Roman]

  • The ____ function reads the entire contents of a file into an indexed array.
    [/list][/font][/color]

    [list=1]
  • file()
  • fopen()
  • fread()
  • fileread()

1: 4, getcwd()
2: 1, $_POST
3: 1, adds
4: 3, relational
5: 2, strrpos()
6: 1, file()

By the way, I’m not doing your midterm or something for you am I? :wink:

:rofl: no you are not. I am doing this for fun and to learn. Hopefully i will learn php soon.

More Questions Coming soon in few minutes.

Well then I’m going to interject my opinion that instead of learning PHP/MySQL with the mysqli_* functions, learn the PDO functions. The only reason I still use the mysql_* functions is a) I initially learned them (PDO wasn’t available then, and I’m not sure mysqli_* was either…), and b) I haven’t had the time yet to make the switch to PDO. It’s on my to-do list, though.

[color=#000000][font=Times New Roman]

  • The comparison operator consists of two ____ signs and performs a different function that the one performed by the assignment operator that consists of a single sign.
    [/list][/font][/color]

    [list=1]
  • percent
  • greater than
  • equal
  • division
                                                       [color=#000000][font=Times New Roman]
  • A ____ key is a field in a related table that refers to the primary key in a primary table.
    [/list][/font][/color]
    [list=1]
  • relational
  • primary
  • single
  • foreign
                                                       [color=#000000][font=Times New Roman]
  • A multidimensional array in PHP is essentially ____.
    [/list][/font][/color]
    [list=1]
  • a two-dimensional array
  • nonexistent
  • an array of arrays
  • an associative array
                                                       [color=#000000][font=Times New Roman]
  • A database management system that stores data in a relational format is called a ____ database management system
    [/list][/font][/color]
    [list=1]
  • flat-file
  • relational
  • hierarchical
  • primary
                                       [color=#000000][font=Times New Roman]
  • You can use the ____ statement to halt a looping statement and restart the loop with a new iteration.
    [/list][/font][/color]
    [list=1]
  • global
  • local
  • while
  • continue
                                                       [color=#000000][font=Times New Roman]
  • To terminate a script execution, use ____.
    [/list][/font][/color]
    [list=1]
  • die()
  • terminate()
  • kill()
  • bye()
                                       [color=#000000][font=Times New Roman]
  • The name you assign to a variable is called a(n)
    [/list][/font][/color]
    [list=1]
  • constant
  • value
  • identifier
  • answer
                                       [color=#000000][font=Times New Roman]
  • To add records to a table, use the keywords ____.
    [/list][/font][/color]
    [list=1]
  • INSERT, VALUES
  • ADD, RECORDS
  • ADD, VALUE
  • INSERT, RECORDS
                                       [color=#000000][font=Times New Roman]
  • Cookies can be temporary or ____
    [/list][/font][/color]
    [list=1]
  • persistent
  • relational
  • invisible
  • hidden
                                       [color=#000000][font=Times New Roman]
  • The ____ combines two strings.
    [/list][/font][/color]
    [list=1]
  • concatenation assignment operator
  • concatenation operator
  • duel operator
  • knot operator

1: 3, equal
2: 4, foreign
3: 3, an array of arrays
4: 2, relational (although the wording of this question makes me hesitant…)
5: 4, continue
6: 1, die() (exit() also works)
7: 3, identifier (?? weird question - the name I assign to a variable I always call its name!)
8: 1, INSERT,VALUES (assuming a SQL database of some kind, that is…)
9: 1, persistent
10: 1 and 2, concatenation assignment operator and concatenation operator

So, out of curiosity, where are you coming up with these questions?

  1. Equal
  2. Foreign
  3. array of arrays
  4. Relational
  5. while
  6. die
  7. identifier
  8. insert values
  9. persistent
  10. concat. operator

I’m a bit rusty… should be 100% though? =\

ahhh… looking at kromey’s answers made me double check and #5 is incorrect. Read it too quickly, apparently. :nono:

I got a book from librarie, i am learning from that and from online tutorials and resources. I am learning both mysqli_* functions and PDO functions.

Last ones

                                                       [color=#000000][font=Times New Roman]
  • Unlike other databases that are installed as applications, on Windows systems, MySQL is installed as a ____.
    [/list][/font][/color]
    [list=1]
  • host
  • service
  • server

[color=#000000][font=Times New Roman]

  • The ____ function reads the contents of a file into a string up to a maximum number of bytes.
    [/list][/font][/color]

    [list=1]
  • file(filename[, use_include_path])
  • file_get_contents(filename[, use_include_path])
  • fread($handle, length)
  • readfile(filename[, use_include_path])
  • Almost every command sent to MySQL from PHP is executed with the ____ function.
    [/list] [list=1]
  • mysqli_connect()
  • mysqli_select()
  • mysqli_send()
  • mysqli_query()
  • The array_pop() function ____ from the end of the array.
    [/list]
    [list=1]
  • moves an element
  • deletes the last element
  • deletes the first element
  • removes the last element
  • The array_shift() function removes the ____ element from the beginning of an array.
    [/list]
    [list=1]
  • last
  • first
  • second
  • middle
  • The array_unshift() function adds ____ element(s) to the beginning of the array.
    [/list]
    [list=1]
  • one or more
  • two or more
  • no new
  • only one
  • The if statement contains three parts: the keyword if, a conditional expression enclosed within parentheses, and the executable ____.
          [list=1]

[]elements
[
]declarations
[]statements
[
]variables
[/list]

  • A ____ relationship exists between two tables when a related table contains exactly one record for each record in the primary table.
          [list=1]

[]one-to-one
[
]one-to-many
[]many-to-many
[
]primary
[/list]

  • ____ is a file-based database instead of a server-based database, such as MySQL.
    [/list]
    [list=1]
  • DBII
  • Oracle
  • SQLite
  • Postgres SQL
  • What function reads a file or directory name from the specified directory handle?
          [list=1]

[]closedir($handle)
[
]getcwd()
[]opendir(directory)
[
]readdir($handle)
[/list]

  • Which of the following is not a tool for maintaining state information with PHP?
    [/list]
    [list=1]
  • hidden form fields
  • query strings
  • functions
  • cookies
  • To select or change a database, use ____.
    [/list] [list=1]
  • mysqli_select_db()
  • select_mysqli_db()
  • change_mysqli_db()
  • change_select_db()
  • The escape sequence to insert a carriage return is ____.
          [list=1]

[]\r
[
]\cr
[]\
[
]\\
[/list]

  • Each column in a database is called a ____.
    [/list]
    [list=1]
  • field
  • row
  • record
  • function
  • Programmers at what company invented SQL in the 1970s?
          [list=1]

[]Sybase
[
]Oracle
[]IBM
[
]Microsoft
[/list]
I got some of them but not all. Let’s see who answer these 1st.

I got most of 'em now.

Why no body answering these question?