PHP Operators Quiz — 14 Questions
PHP Operators Quiz हिंदी में — arithmetic, assignment, comparison (== vs ===), logical, spaceship, ternary, null coalescing (??) और ??= operators से जुड़े 14 important questions। BCA, MCA, BSc students के लिए।
-
PHP में Operator क्या होता है?
- एक special symbol जो values पर operation perform करके result देता है
- एक function जो variables store करता है
- एक keyword जो loops बनाने के लिए use होता है
- एक method जो database से data लाता है
-
$a = 10; $b = 3; होने पर $a % $b का result क्या होगा?
- 1 — 10 को 3 से भाग देने पर शेषफल 1 बचता है
- 3 — भाग का result
- 0 — कोई शेष नहीं
- 7 — घटाव का result
-
PHP में ** operator क्या करता है?
- Exponentiation (घात) — जैसे 2 ** 8 = 256
- Double multiplication — $a को 2 से गुणा
- String repeat करना
- यह PHP में valid operator नहीं है
-
$score = 50; $score += 10; के बाद $score की value क्या होगी?
- 60
- 50
- 10
- 500
-
PHP में .= operator किसलिए use होता है?
- String में और text जोड़कर assign करने के लिए
- Float value assign करने के लिए
- Variable को NULL set करने के लिए
- Array में item जोड़ने के लिए
-
PHP में 0 == "abc" का result क्या होगा?
- true — PHP "abc" को 0 में convert कर देता है
- false — दोनों अलग types हैं
- Error आएगी
- null
-
PHP में Spaceship Operator <=> क्या return करता है जब left value बड़ी हो?
- 1
- -1
- 0
- true
-
PHP में && और || operators किसलिए use होते हैं?
- Multiple conditions को combine करने के लिए — Logical operations
- Strings जोड़ने के लिए
- Numbers की comparison के लिए
- Variables assign करने के लिए
-
PHP में strings जोड़ने के लिए कौन सा operator use होता है?
- . (Dot operator)
- + (Plus operator)
- & (Ampersand operator)
- , (Comma operator)
-
echo $a++; और echo ++$a; में क्या फर्क है? (जब $a = 5 हो)
- $a++ पहले 5 print करता है फिर बढ़ाता है; ++$a पहले बढ़ाकर 6 print करता है
- दोनों एक जैसे काम करते हैं — दोनों 6 print करते हैं
- $a++ पहले बढ़ाता है, ++$a बाद में बढ़ाता है
- दोनों error देते हैं
-
Ternary Operator का सही syntax क्या है?
- condition ? true_value : false_value
- condition : true_value ? false_value
- condition ?? true_value : false_value
- if(condition) ? true_value : false_value
-
PHP 7+ में Null Coalescing Operator ?? किसलिए use होता है?
- अगर value null या undefined है तो default value देने के लिए
- दो numbers को compare करने के लिए
- String को null में convert करने के लिए
- Variable को delete करने के लिए
-
?? (Null Coalescing) और ?: (Elvis) operator में क्या फर्क है?
- ?? सिर्फ null/undefined check करता है; ?: सभी falsy values (0, false, "", null) पर default देता है
- दोनों बिल्कुल same काम करते हैं
- ?? PHP 5 में है; ?: PHP 7 में आया
- ?? strings के लिए है; ?: numbers के लिए
-
PHP में ??= operator का क्या काम है?
- अगर variable null है तो उसे default value assign करता है — PHP 7.4+
- दो null values को compare करता है
- Variable को forcefully null set करता है
- Null values को automatically delete करता है