Computer AwarenessHardSSC CGL · RRB NTPC · IBPS PO · SBI Clerk
A program has an error in line 7 of 10. Which statement about how it will behave is correct?
- A. With an interpreter, no line executes; with a compiler, lines 1 to 6 execute before it stops
- B. With an interpreter, lines 1 to 6 execute before the error stops it; with a compiler, the error is reported before any of the program runs
- C. Both an interpreter and a compiler execute lines 1 to 6 and then stop at line 7
- D. Both report the error before executing any line of the program
Correct answer: B. With an interpreter, lines 1 to 6 execute before the error stops it; with a compiler, the error is reported before any of the program runs
An interpreter translates and runs one statement at a time, so earlier lines run first. A compiler translates the whole program first, so a syntax error stops the build before execution begins.
हिंदी में
किसी प्रोग्राम की 10 में से 7वीं पंक्ति में त्रुटि है। उसके व्यवहार के बारे में कौन-सा कथन सही है?
- A. इंटरप्रेटर के साथ कोई पंक्ति नहीं चलती; कंपाइलर के साथ पंक्ति 1 से 6 चलने के बाद वह रुकता है
- B. इंटरप्रेटर के साथ पंक्ति 1 से 6 चलने के बाद त्रुटि उसे रोकती है; कंपाइलर के साथ प्रोग्राम का कोई भाग चलने से पहले त्रुटि बता दी जाती है
- C. इंटरप्रेटर और कंपाइलर दोनों पंक्ति 1 से 6 चलाकर पंक्ति 7 पर रुकते हैं
- D. दोनों प्रोग्राम की कोई पंक्ति चलाने से पहले त्रुटि बताते हैं
उत्तर: B. इंटरप्रेटर एक बार में एक कथन अनुवाद करके चलाता है, इसलिए पहले की पंक्तियाँ चल जाती हैं। कंपाइलर पहले पूरे प्रोग्राम का अनुवाद करता है, इसलिए सिंटैक्स त्रुटि निष्पादन शुरू होने से पहले ही बिल्ड रोक देती है।
More Computer Awareness questions
- In a desktop computer, the SMPS (Switched Mode Power Supply) is used to:
- A Virtual Private Network (VPN) is best described as:
- Which sequence correctly shows what happens when a PC is switched on?
- Restarting a running computer using the Restart option or Ctrl + Alt + Delete, without cutting its power, is called a:
- A device joins two networks that use different protocol architectures and converts messages from one format to the other. Which device is…
- An 8-bit checksum is the sum of all data bytes modulo 256. Three data bytes are 0x12, 0x34 and 0x56 (hexadecimal). What is the checksum?