Programming Languages — Set 2
Computers · प्रोग्रामिंग भाषाएं · Questions 11–20 of 60
What is the primary role of a 'Compiler' in the programming process?
Correct Answer: A. To translate source code to machine code
• **Compiler translates source code to machine code** = A compiler reads the entire source code of a program written in a high-level language like C or C++, analyzes it fully, and produces a separate executable binary file containing machine instructions that the CPU can run directly — all in one pass before execution begins. • **One-time translation, faster runtime** — Because the translation happens before the program runs, the compiled binary executes at maximum speed with no overhead, unlike interpreted languages that translate line by line during runtime. • Famous compilers include GCC (GNU Compiler Collection) for C/C++ and javac for Java, which compiles to bytecode rather than native machine code. • 💡 Option B (To find errors in logic) is wrong because finding logic errors is the job of a debugger, not a compiler; Option C (To run the program) is wrong because compilers produce an executable but do not run it; Option D (To provide a text editor) is wrong because text editors and compilers are completely separate tools.
Which language, named after a 19th-century mathematician, was developed for the US Department of Defense?
Correct Answer: D. Ada
• **Ada** = Developed for the U.S. Department of Defense between 1977–1983 and named after Ada Lovelace — widely regarded as the world's first computer programmer — Ada was mandated for all defense software because of its extreme reliability and strict error-checking rules. • **Built for life-critical systems** — Ada's strong typing, mandatory exception handling, and concurrency support make it the language of choice for aircraft flight control systems, spacecraft navigation, and nuclear plant controls where a software bug can cost lives. • Ada Lovelace, after whom the language is named, wrote the first algorithm intended for Charles Babbage's Analytical Engine in 1843, over a century before the first computers were built. • 💡 Option A (Pascal) is wrong because Pascal was designed by Niklaus Wirth as a teaching language, not for defense use; Option B (Lovelace) is wrong because 'Lovelace' is not a programming language — Ada Lovelace is the person the language Ada is named after; Option C (Babbage) is wrong because Charles Babbage was a mathematician who designed computing machines, not a programming language.
Which of these is a low-level language that is directly understood by the computer's CPU?
Correct Answer: A. Machine Language
• **Machine Language** = Machine language consists exclusively of binary digits — sequences of 0s and 1s — that map directly to the electronic on/off states inside the CPU's transistors, making it the only language a processor can execute without any translation whatsoever. • **No translation layer needed** — Every other language (assembly, C, Python) must be converted into machine code before the CPU runs it; machine language skips that step entirely because it already is the CPU's native instruction set. • Writing in machine language requires knowing the exact binary opcode for every instruction on a specific processor — for example, 10110000 01100001 on x86 means 'move the value 97 into register AL' — which is why virtually no human writes it directly today. • 💡 Option B (C) is wrong because C is a high-level language that must be compiled into machine code before execution; Option C (Assembly) is wrong because assembly uses mnemonics like MOV and ADD that still require an assembler to convert them to binary; Option D (Python) is wrong because Python is a high-level interpreted language far removed from the CPU's instruction level.
Which language was developed by Niklaus Wirth as a tool for teaching structured programming?
Correct Answer: D. Pascal
• **Pascal** = Developed by Niklaus Wirth and released in 1970, Pascal was specifically designed as a teaching tool to instill structured programming discipline — it requires programmers to declare all variables before use, define clear procedure boundaries, and follow a strict block structure. • **Named after mathematician Blaise Pascal** — Blaise Pascal invented one of the earliest mechanical calculators in the 17th century, and Wirth honored him by naming the language that would teach the next generation of programmers. • Pascal was the dominant teaching language at universities worldwide from the 1970s through the 1990s, and early Apple Lisa and Macintosh software was written largely in Pascal. • 💡 Option A (BASIC) is wrong because BASIC was designed for ease of use and interactivity, not structured programming discipline; Option B (Fortran) is wrong because Fortran was created for scientific computation, not pedagogy; Option C (C) is wrong because C was designed by Dennis Ritchie for systems programming at Bell Labs, not as a structured teaching language.
Which language is primarily used for system-level programming and game development due to its performance and efficiency?
Correct Answer: A. C++
• **C++** = Created by Bjarne Stroustrup at Bell Labs in 1983 as an extension of C, C++ adds object-oriented features (classes, inheritance, polymorphism) on top of C's low-level capabilities, giving programmers both the power to control hardware directly and the organizational tools to manage large software systems. • **No garbage collection, maximum performance** — Unlike Java or Python, C++ gives the programmer manual control over memory allocation and deallocation, which eliminates runtime overhead and makes it the fastest choice for performance-critical software like game engines, graphics renderers, and OS kernels. • Major video game engines including Unreal Engine are written in C++, and most of the Windows, macOS, and Linux kernels have substantial C++ components. • 💡 Option B (Java) is wrong because Java runs on a virtual machine with garbage collection, making it slower and unsuitable for real-time game physics; Option C (HTML) is wrong because HTML is a markup language used for web page structure with no computational logic; Option D (SQL) is wrong because SQL is a query language for databases with no ability to control hardware or build applications.
What is the main purpose of the 'SQL' language in computing?
Correct Answer: A. Database Management
• **SQL (Structured Query Language) = Database Management** = SQL is the standard language for communicating with relational databases — it lets users create tables (CREATE), read records (SELECT), modify data (UPDATE), and remove entries (DELETE) through simple, English-like commands. • **CRUD operations as its core purpose** — The four fundamental operations Create, Read, Update, Delete define what SQL does; every data-driven application from banking software to e-commerce websites relies on SQL to interact with its stored information. • SQL was developed by IBM researchers in the 1970s based on Edgar Codd's relational model theory, and it became an ANSI/ISO standard in 1986 — meaning the same SQL code largely works across Oracle, MySQL, PostgreSQL, and SQL Server. • 💡 Option B (System Hardware Control) is wrong because controlling hardware is done at the assembly or OS level, not through SQL; Option C (Web Designing) is wrong because web design uses HTML, CSS, and JavaScript, not SQL; Option D (Network Security) is wrong because network security involves firewalls, encryption, and protocols — SQL has no role there.
Which language was designed to be easy for beginners and was built into most early microcomputers?
Correct Answer: D. BASIC
• **BASIC (Beginners' All-purpose Symbolic Instruction Code)** = Developed in 1964 at Dartmouth College by John Kemeny and Thomas Kurtz, BASIC was deliberately simplified so that students from any academic background — not just science majors — could write and run programs on a computer. • **Default language of the home computer era** — In the 1980s, when people bought an Apple II, Commodore 64, or early IBM PC, the machine booted directly into BASIC; it was the first programming language millions of non-engineers ever encountered. • Bill Gates and Paul Allen wrote a BASIC interpreter for the Altair 8800 in 1975 as Microsoft's founding product, making BASIC the language that launched the world's most valuable software company. • 💡 Option A (FORTRAN) is wrong because FORTRAN was designed for professional scientists and engineers doing complex numerical work; Option B (Pascal) is wrong because Pascal was a structured teaching language primarily used in universities, not home computers; Option C (COBOL) is wrong because COBOL was designed for enterprise business data processing, requiring significant training.
Which type of language is 'PROLOG' generally categorized as, based on its focus on facts and rules?
Correct Answer: A. Logic Programming
• **PROLOG = Logic Programming** = PROLOG (Programming in Logic), developed in 1972 by Alain Colmerauer, lets programmers define a database of facts and inference rules, then pose questions — the language's built-in inference engine searches for answers automatically, without the programmer specifying step-by-step how to find them. • **Declarative, not procedural** — In PROLOG you say what is true (facts) and what implies what (rules), not how to compute the answer; this paradigm shift makes it powerful for problems like natural language parsing, expert systems, and theorem proving. • PROLOG was used in Japan's Fifth Generation Computer Systems project in the 1980s, an ambitious national effort to build AI machines that could reason in natural language. • 💡 Option B (Object-Oriented) is wrong because OOP organizes code around objects and their behaviors, a completely different paradigm from logic-based fact-and-rule systems; Option C (Procedural) is wrong because procedural languages like C define an explicit sequence of steps — the opposite of PROLOG's declarative approach; Option D (Scripting) is wrong because scripting languages automate tasks through sequential command execution, not logical inference.
Which markup language is the standard for creating the structure of web pages?
Correct Answer: C. HTML
• **HTML (HyperText Markup Language)** = HTML is the standard markup language used to create the structure and content of every web page; it uses opening and closing tags like <h1>, <p>, and <a> to tell browsers how to interpret and display text, images, and links. • **Skeleton of the web, not a programming language** — HTML describes what content is on a page and how it is organized, but it contains no logic, conditions, loops, or computations — those require JavaScript; calling HTML a programming language is a common misconception. • Tim Berners-Lee invented HTML in 1991 at CERN as part of creating the World Wide Web; the HyperText part refers to clickable links connecting documents across the internet. • 💡 Option A (XML) is wrong because XML is a data storage and transport format, not a language for building web page structure visible to users; Option B (JavaScript) is wrong because JavaScript provides web page interactivity and logic but does not define page structure; Option D (Perl) is wrong because Perl is a general-purpose scripting language used on servers, not for marking up web page content.
Which language was developed by Apple as a faster and safer replacement for Objective-C?
Correct Answer: C. Swift
• **Swift** = Introduced by Apple at WWDC 2014 and designed by Chris Lattner, Swift replaced Objective-C as the primary language for building apps on iOS, macOS, watchOS, and tvOS — with significantly cleaner syntax, faster execution, and built-in protection against the most common Objective-C bugs like null pointer crashes. • **Safety by design** — Swift introduced optionals, a type-system feature that forces programmers to explicitly handle the possibility that a value might be absent, eliminating entire categories of runtime crashes that plagued Objective-C code. • Swift became open-source in 2015 and is now used for Linux server development as well; it consistently ranks among the most loved languages in developer surveys. • 💡 Option A (Ruby) is wrong because Ruby is a general-purpose scripting language with no connection to Apple's development ecosystem; Option B (Kotlin) is wrong because Kotlin is Google's modern language for Android development, the equivalent of Swift but for a different platform; Option D (Rust) is wrong because Rust is a systems programming language focused on memory safety, developed by Mozilla, not Apple.