K Kanak Sharma 🎓 Tutor III ⭐ 6.13K Points 📊 PHP Q. Which PHP function checks if a method exists in a class? (A) method_exists() (B) function_exists() (C) class_has_method() (D) callable_exists() 👁️ Show Answer 💬 Discuss 🔗 Share ✅ Correct Answer: (A) method_exists() Explanation: method_exists() checks if a method exists in an object or class.
K Kanak Sharma 🎓 Tutor III ⭐ 6.13K Points 📊 PHP Q. Which PHP function checks if a variable is empty? (A) is_null() (B) isset() (C) empty() (D) blank() 👁️ Show Answer 💬 Discuss 🔗 Share ✅ Correct Answer: (C) empty() Explanation: empty() checks for empty values including 0, '', null, false.
A Admin 🎓 Coach ⭐ 38.23K Points 📊 PHP Q. Which PHP extension is required to use PDO? (A) mysqli (B) pdo_mysql (C) pdo (D) mysql 👁️ Show Answer 💬 Discuss 🔗 Share ✅ Correct Answer: (C) pdo Explanation: The PDO core extension is required; drivers like pdo_mysql are database-specific.
A Admin 🎓 Coach ⭐ 38.23K Points 📊 PHP Q. Which PDO method prepares an SQL statement? (A) query() (B) execute() (C) prepare() (D) bind() 👁️ Show Answer 💬 Discuss 🔗 Share ✅ Correct Answer: (C) prepare() Explanation: prepare() prepares a statement for execution.
A Admin 🎓 Coach ⭐ 38.23K Points 📊 PHP Q. Which PDO method executes a prepared statement? (A) run() (B) query() (C) execute() (D) fetch() 👁️ Show Answer 💬 Discuss 🔗 Share ✅ Correct Answer: (C) execute() Explanation: execute() runs the prepared statement.
A Admin 🎓 Coach ⭐ 38.23K Points 📊 PHP Q. Which PDO fetch mode returns results as associative arrays? (A) PDO::FETCH_NUM (B) PDO::FETCH_OBJ (C) PDO::FETCH_ASSOC (D) PDO::FETCH_BOTH 👁️ Show Answer 💬 Discuss 🔗 Share ✅ Correct Answer: (C) PDO::FETCH_ASSOC Explanation: FETCH_ASSOC returns only associative array results.
A Admin 🎓 Coach ⭐ 38.23K Points 📊 PHP Q. Which PDO fetch mode returns results as objects? (A) PDO::FETCH_OBJ (B) PDO::FETCH_CLASS (C) PDO::FETCH_ASSOC (D) PDO::FETCH_LAZY 👁️ Show Answer 💬 Discuss 🔗 Share ✅ Correct Answer: (A) PDO::FETCH_OBJ Explanation: FETCH_OBJ maps rows to anonymous objects.
A Admin 🎓 Coach ⭐ 38.23K Points 📊 PHP Q. Which PDO method starts a database transaction? (A) startTransaction() (B) begin() (C) beginTransaction() (D) transaction() 👁️ Show Answer 💬 Discuss 🔗 Share ✅ Correct Answer: (C) beginTransaction() Explanation: beginTransaction() starts a DB transaction.
A Admin 🎓 Coach ⭐ 38.23K Points 📊 PHP Q. Which PDO method commits a transaction? (A) save() (B) commit() (C) end() (D) complete() 👁️ Show Answer 💬 Discuss 🔗 Share ✅ Correct Answer: (B) commit() Explanation: commit() saves changes permanently.
A Admin 🎓 Coach ⭐ 38.23K Points 📊 PHP Q. Which PDO method rolls back a transaction? (A) rollback() (B) undo() (C) cancel() (D) reverse() 👁️ Show Answer 💬 Discuss 🔗 Share ✅ Correct Answer: (A) rollback() Explanation: rollback() reverts transaction changes.