Free Programming Basics MCQs with Answers

183 Programming Basics MCQs from Computer Science and IT, each with the correct answer and a written explanation of why it is correct. Free and unlimited, with no account needed.

Programming basics covers algorithms, flowcharts, pseudocode, variables, constants, data types, operators, input and output, conditional statements and loops. It also introduces functions, arrays, strings, debugging and common programming errors, with attention to the difference between syntax errors, runtime errors and logical errors in a program.

Last updated

183 questions · page 3 of 10

Fairly easy
  • A. procedural language
  • B. structures
  • C. natural language
  • D. programming language

Explanation: A programming language is a formal set of rules and symbols used to specify operations for a computer. A procedural language is only one type of programming language, not the general term.

Correct answer: programming language
Hard
  • A. Time-related bomb sequence.
  • B. Virus.
  • C. Time bomb.
  • D. Trojan horse.Computer Online Quiz

Explanation: A logic bomb triggered by a specified date or time is called a time bomb. A logic bomb can also be triggered by another condition, so the time-based trigger is what defines this subtype.

Correct answer: Time bomb.
Hard
  • A. End user
  • B. System Analyst
  • C. Programmer
  • D. All of the above

Explanation: A systems analyst plans requirements and designs the overall structure of a program or system. The programmer implements that design, and the end user normally operates the finished system rather than designing it.

Correct answer: System Analyst
Moderate
  • A. Common Business Oriented Language
  • B. Computer Business Oriented Language
  • C. Common Business Operated Language
  • D. Common Business Organized Language

Explanation: COBOL expands to Common Business Oriented Language, reflecting its original use in business data processing and commercial applications.

Correct answer: Common Business Oriented Language
Moderate
  • A. MS-Excel
  • B. BASIC
  • C. COBOL
  • D. C++

Explanation: BASIC, COBOL, and C++ are programming languages. MS Excel is spreadsheet application software, not a computer language.

Correct answer: MS-Excel
Moderate
  • A. Dennis Ritchie
  • B. Prof John Keenly
  • C. Thomas Kurtz
  • D. Bill Gates

Explanation: Dennis Ritchie developed the C programming language at Bell Labs, making him widely known as its father. The other names listed are associated with different areas or are not the creator of C.

Correct answer: Dennis Ritchie
Easy
  • A. Compiler
  • B. Interpreter
  • C. Linker
  • D. Loader

Explanation: An interpreter translates and executes source code one statement at a time while the program runs. A compiler generally translates the program before execution and produces object or executable code.

Correct answer: Interpreter
Easy
  • A. Boot
  • B. Bug
  • C. Biff
  • D. Strap

Explanation: A bug is a fault or defect in a program that causes incorrect or unexpected behaviour. Boot refers to starting a computer, not to a programming error.

Correct answer: Bug
Fairly easy
  • A. Interpreter
  • B. Simulator
  • C. Compiler
  • D. Commander

Explanation: A compiler translates an entire source program into machine code or another lower-level form before execution. An interpreter translates and executes instructions one at a time.

Correct answer: Compiler
Hard
  • A. Leech
  • B. Squid
  • C. Slug
  • D. Glitch

Explanation: Glitch is common computer jargon for a minor fault or unexpected malfunction in software or hardware. Leech, squid and slug are not standard synonyms for a computer bug.

Correct answer: Glitch
Moderate
  • A. Dennis M. Ritchie
  • B. Niklaus Writh
  • C. Seymour Papert
  • D. Donald Kunth

Explanation: Dennis M. Ritchie created the C programming language at Bell Labs in the early 1970s. Niklaus Wirth is associated with Pascal, not C.

Correct answer: Dennis M. Ritchie
Moderate
  • A. BASIC, COBOL, Fortran
  • B. Prolog
  • C. C, C++
  • D. Assembly languages

Explanation: Assembly language is a low-level language closely tied to a processor's instruction set and registers. BASIC, COBOL, Fortran and Prolog are generally classified as high-level languages, while C and C++ are commonly treated as high-level or middle-level languages.

Correct answer: Assembly languages
Hard
  • A. Assembly language
  • B. Machine language
  • C. Source code
  • D. Object code

Explanation: The earliest computers were programmed in machine language, using binary instructions directly understood by the processor. Assembly language came later as a more readable symbolic representation of machine instructions.

Correct answer: Machine language
  • A. my_var
  • B. _score
  • C. return
  • D. total3

Explanation: In C programming, identifiers are names given to variables, functions, constants, and other user-defined elements. Here's why return is not a valid identifier:Reserved keywords: return is a reserved keyword in C. Reserved keywords have specific meanings in the language and cannot be used as identifiers. Other examples of reserved keywords in C include int, for, while, and if.Valid identifiers:Must start with a letter (a-z or A-Z) or an underscore (_).Can contain letters, digits (0-9), and underscores after the first character.Are case-sensitive (e.g., age and Age are considered different identifiers).Cannot be the same as a reserved keyword

Correct answer: return
  • A. float
  • B. int
  • C. double
  • D. long

Explanation: In many computer systems, including most modern systems, an int (integer) data type typically takes two bytes in memory. This is because two bytes can store a wider range of values than one byte, which is useful for representing whole numbers used in many programming tasks

Correct answer: int
  • A. 0
  • B. 1
  • C. 2
  • D. 4

Explanation: The percent sign (%) in this context refers to the modulo operation. The modulo operation calculates the remainder after a division is performed. In this case, 0 divided by 4 is 0 with no remainder. Therefore, 0 % 4 is equal to 0.

Correct answer: 0
  • A. long
  • B. char
  • C. float
  • D. int

Explanation: The float data type in C is a single-precision floating-point data type. It is commonly used to represent numbers with decimal points. It typically uses 32 bits to store a number, which allows for a balance between precision and memory usage.

Correct answer: float
  • A. define
  • B. loading
  • C. allocating
  • D. initializing

Explanation: Initializing a variable refers to assigning a value to it at the time it is declared. This is a common and good practice in programming because it ensures that the variable has a known value from the start. It helps to avoid errors that can occur if you try to use a variable before it has been assigned a value

Correct answer: initializing
  • A. exponentiation
  • B. multiplication
  • C. integer reminder
  • D. division

Explanation: The modulus operator (%) in C programming is used to find the remainder after a division operation. It gives the non-negative value left after dividing the first operand by the second.For example:10 % 3 evaluates to 1 because 10 divided by 3 leaves a remainder of 1.17 % 5 evaluates to 2 because 17 divided by 5 leaves a remainder of 2.

Correct answer: integer reminder
  • A. zero
  • B. garbage
  • C. 1
  • D. nothing

Explanation: When a variable is declared in C but not explicitly initialized, its memory location is allocated but not assigned a specific value. This means the variable can contain any arbitrary data that happens to be at that memory location at the time the program is run. This value is often referred to as garbage data or indeterminate value.

Correct answer: garbage