Skip to main content

Menu

Home Quizzes Categories Current Affairs GK AI ToolsNEW Play Live Contact

Python Quiz

Test your Python knowledge across syntax, data structures, functions and everyday programming concepts.

25 Questions
30 min Duration
40% To pass
1.00 Marks / correct

Instructions

  • This quiz has 25 questions.
  • Questions are picked at random from a bank of 50, so each attempt is different.
  • You have 30 minutes. The quiz submits automatically when time runs out.
  • You need 40% to pass.
  • There is no negative marking.
  • You can mark questions for review and return to them before submitting.
  • Correct answers and explanations are shown after you submit.

Sample Questions & Answers

A preview of 12 questions from this quiz, each with the correct answer and a written explanation. Attempt the full, timed quiz to be scored and earn XP.

  1. Question 1

    In PHP, which option best describes $variable?

    • A PHP construct defining reusable behavior
    • An object representing an exceptional condition
    • PHP variable syntax using a dollar sign before the variable name Correct answer
    • A function that converts special HTML characters to safe entities
    Explanation: $variable is correctly described by: PHP variable syntax using a dollar sign before the variable name.
  2. Question 2

    In PHP, which option best describes <?php?

    • A PHP OOP mechanism for deriving one class from another
    • A standard opening tag for PHP code Correct answer
    • A construct that includes a file and fails if it cannot be included
    • A function used to create secure password hashes
    Explanation: <?php is correctly described by: A standard opening tag for PHP code.
  3. Question 3

    In PHP, which option best describes echo?

    • A PHP construct used to output data Correct answer
    • A construct used for exception handling
    • A construct that includes another PHP file
    • A function used to verify a password against a hash
    Explanation: echo is correctly described by: A PHP construct used to output data.
  4. Question 4

    In PHP, which option best describes count()?

    • An object representing an exceptional condition
    • A function that converts special HTML characters to safe entities
    • A function used to send HTTP response headers
    • A function that counts elements in an array Correct answer
    Explanation: count() is correctly described by: A function that counts elements in an array.
  5. Question 5

    In PHP, which option best describes associative array?

    • A construct that includes a file and fails if it cannot be included
    • A function used to create secure password hashes
    • An array using named keys Correct answer
    • A construct that checks whether a variable is set and not null
    Explanation: associative array is correctly described by: An array using named keys.
  6. Question 6

    In PHP, which option best describes $_GET?

    • A construct that includes another PHP file
    • A PHP superglobal containing query-string parameters Correct answer
    • A function used to verify a password against a hash
    • A construct that checks whether a value is empty according to PHP rules
    Explanation: $_GET is correctly described by: A PHP superglobal containing query-string parameters.
  7. Question 7

    In PHP, which option best describes $_POST?

    • A PHP superglobal containing POST data Correct answer
    • A function that converts special HTML characters to safe entities
    • A function used to send HTTP response headers
    • An operator that uses a fallback when the left operand is null
    Explanation: $_POST is correctly described by: A PHP superglobal containing POST data.
  8. Question 8

    In PHP, which option best describes $_SESSION?

    • A function used to create secure password hashes
    • A construct that checks whether a variable is set and not null
    • The PHP operator used to concatenate strings
    • A PHP superglobal containing session variables Correct answer
    Explanation: $_SESSION is correctly described by: A PHP superglobal containing session variables.
  9. Question 9

    In PHP, which option best describes session_start()?

    • A function used to verify a password against a hash
    • A construct that checks whether a value is empty according to PHP rules
    • A function used to start or resume a PHP session Correct answer
    • A PHP mechanism for reusing methods across classes
    Explanation: session_start() is correctly described by: A function used to start or resume a PHP session.
  10. Question 10

    In PHP, which option best describes cookie?

    • A function used to send HTTP response headers
    • Data stored by the browser and sent with requests to a site Correct answer
    • An operator that uses a fallback when the left operand is null
    • A PHP contract specifying methods a class must implement
    Explanation: cookie is correctly described by: Data stored by the browser and sent with requests to a site.
  11. Question 11

    In PHP, which option best describes PDO?

    • A PHP interface for database access Correct answer
    • A construct that checks whether a variable is set and not null
    • The PHP operator used to concatenate strings
    • A keyword that can prevent inheritance or overriding
    Explanation: PDO is correctly described by: A PHP interface for database access.
  12. Question 12

    In PHP, which option best describes prepared statement?

    • A construct that checks whether a value is empty according to PHP rules
    • A PHP mechanism for reusing methods across classes
    • A reference to the current object instance
    • A database statement separating SQL structure from parameter values Correct answer
    Explanation: prepared statement is correctly described by: A database statement separating SQL structure from parameter values.

Login/Register to attempt the full quiz and earn XP.

Explore more: All Computer & Technology quizzes · PHP

Python Programming

Python has a readable syntax and is used across many areas of software development. Use this quiz to revise common language features and the programming concepts that form a solid Python foundation.

Frequently Asked Questions

Each attempt serves 25 questions, drawn at random from a bank of 50, with 30 minutes.

You need at least 40% to pass this quiz.

No, there is no negative marking on this quiz.

Yes. You can attempt this quiz again at any time, though first-attempt XP bonuses apply only once.

Sign in to attempt this quiz and earn XP.

Login to Start Create free account

Related Quizzes