[ PHP Programming MCQS ]
झारखंड में आयोजित होने वाली JPSC, JSSC, JET, झारखंड पुलिस भर्ती परीक्षा आदि के लिए उपयोगी सामान्य अध्ययन।
[ PHP Programming MCQS ]
Useful GK for JPSC, JSSC, JET, Jharkhand Police and other exams.
221. PHP में array key और value दोनों प्राप्त करने के लिए कौन-सा loop उपयुक्त है?
[A] for
[B] while
[C] foreach
[D] do while
221. Which loop is best for accessing both key and value in arrays?
[A] for
[B] while
[C] foreach
[D] do while
सही उत्तर: foreach
व्याख्या: Associative arrays के लिए सर्वोत्तम।
Correct Answer: foreach
Explanation: Best suited for associative arrays.
222. MySQL query के result rows की संख्या जानने के लिए कौन-सा function प्रयोग होता है?
[A] mysqli_num_rows()
[B] mysqli_rows()
[C] row_count()
[D] count_rows()
222. Which function returns the number of rows in a MySQL result?
[A] mysqli_num_rows()
[B] mysqli_rows()
[C] row_count()
[D] count_rows()
सही उत्तर: mysqli_num_rows()
व्याख्या: SELECT query results count करता है।
Correct Answer: mysqli_num_rows()
Explanation: Counts rows in SELECT results.
223. INSERT query के बाद last inserted ID प्राप्त करने के लिए कौन-सा function प्रयोग होता है?
[A] mysqli_last_id()
[B] mysqli_insert_id()
[C] last_insert()
[D] insert_id()
223. Which function returns the last inserted ID?
[A] mysqli_last_id()
[B] mysqli_insert_id()
[C] last_insert()
[D] insert_id()
सही उत्तर: mysqli_insert_id()
व्याख्या: Auto increment ID return करता है।
Correct Answer: mysqli_insert_id()
Explanation: Returns the auto-increment ID.
224. PHP में JSON string को associative array में बदलने के लिए json_decode() का दूसरा parameter क्या होना चाहिए?
[A] 0
[B] NULL
[C] true
[D] false
224. What should be the second parameter of json_decode() to get an associative array?
[A] 0
[B] NULL
[C] true
[D] false
सही उत्तर: true
व्याख्या: json_decode($json, true) associative array return करता है।
Correct Answer: true
Explanation: json_decode($json, true) returns an associative array.
225. PHP में str_replace() function का उपयोग किसलिए किया जाता है?
[A] String Compare
[B] String Replace
[C] String Split
[D] String Reverse
225. What is str_replace() used for?
[A] String Compare
[B] String Replace
[C] String Split
[D] String Reverse
सही उत्तर: String Replace
व्याख्या: String के अंदर text replace करने के लिए।
Correct Answer: String Replace
Explanation: Used to replace text within a string.
226. PHP में substr() function का उपयोग किसलिए किया जाता है?
[A] Substring निकालने के लिए
[B] String जोड़ने के लिए
[C] String Compare करने के लिए
[D] String Encrypt करने के लिए
226. What is substr() used for?
[A] Extract Substring
[B] Concatenate String
[C] Compare String
[D] Encrypt String
सही उत्तर: Substring निकालने के लिए
व्याख्या: String का एक भाग प्राप्त करता है।
Correct Answer: Extract Substring
Explanation: Returns a portion of a string.
227. PHP में strpos() function क्या return करता है?
[A] String Length
[B] Character Count
[C] Substring Position
[D] Boolean Only
227. What does strpos() return?
[A] String Length
[B] Character Count
[C] Substring Position
[D] Boolean Only
सही उत्तर: Substring Position
व्याख्या: String में substring की पहली position।
Correct Answer: Substring Position
Explanation: Returns first occurrence position.
228. PHP में trim() function का उपयोग किसलिए किया जाता है?
[A] Spaces Remove
[B] String Reverse
[C] Uppercase Convert
[D] Array Sort
228. What is trim() used for?
[A] Remove Spaces
[B] Reverse String
[C] Convert to Uppercase
[D] Sort Array
सही उत्तर: Spaces Remove
व्याख्या: String के शुरुआत और अंत के spaces हटाता है।
Correct Answer: Remove Spaces
Explanation: Removes spaces from beginning and end.
229. PHP में explode() function क्या करता है?
[A] Array Merge
[B] String Split
[C] Array Sort
[D] String Join
229. What does explode() do?
[A] Merge Array
[B] Split String
[C] Sort Array
[D] Join String
सही उत्तर: String Split
व्याख्या: Delimiter के आधार पर string को array में बदलता है।
Correct Answer: Split String
Explanation: Converts string into array using delimiter.
230. PHP में implode() function क्या करता है?
[A] Array को String में बदलता है
[B] String को Array में बदलता है
[C] String Compare करता है
[D] Array Sort करता है
230. What does implode() do?
[A] Converts Array to String
[B] Converts String to Array
[C] Compares String
[D] Sorts Array
सही उत्तर: Array को String में बदलता है
व्याख्या: Array elements को जोड़कर string बनाता है।
Correct Answer: Converts Array to String
Explanation: Joins array elements into a string.