In programming, a source program (source code) is best described as which of the following?

Difficulty: Easy

Correct Answer: A program written in a high-level or assembly language that is to be translated into machine language

Explanation:


Introduction / Context:
When software is developed, programmers usually write instructions in a high-level language such as C, Java or Python, or in assembly language. Computers, however, can only execute instructions in machine language, which is a sequence of binary codes. The term source program refers to the human readable version written by the programmer before it is translated into machine code. This question checks whether you can correctly identify what a source program is in comparison with machine language and object code.


Given Data / Assumptions:

  • The context is program development and translation.
  • We distinguish between source code and machine code.
  • Compilers or assemblers are used to translate one form to another.
  • Options mix up source, machine and object code definitions.


Concept / Approach:
A source program is the original version of the program written by the programmer in a high-level language or assembly language. It is usually stored in text files and can be read and modified by humans. This source program is then processed by a compiler or assembler to produce an object program or machine language version that the CPU can execute. Once translated, the resulting binary is no longer called source; it is object code or executable code. Therefore, the correct definition emphasises that a source program is to be translated into machine language, not that it is already in machine language.


Step-by-Step Solution:

Step 1: Remember that programmers typically write code using high-level languages with keywords and symbols humans can understand. Step 2: Recognise that this human readable code is called source code or source program. Step 3: Recall that a compiler or assembler takes the source program as input and produces machine language or object code as output. Step 4: Check the options and select the one that describes a program written in a high-level or assembly language to be translated into machine language. Step 5: Reject options that describe machine code itself or object code, which are the result of translation, not the source.


Verification / Alternative check:
Textbooks on compilers and programming repeatedly use the term source program for the original code supplied by the programmer and object program for the translated machine code. Development tools label files with extensions such as .c, .java or .asm as source files. Documentation for compilers explicitly refers to reading source code and producing executable or object files. None of these references call the machine language version a source program. This clear and consistent terminology across programming resources confirms that the correct answer is the high-level or assembly program awaiting translation.


Why Other Options Are Wrong:

  • A program already written in machine language instructions: This is usually referred to as object code or executable code, not source program.
  • The machine language translation (object code) of a program: Again, this is the compiled result, not the source.
  • All of the above at the same time: A single program cannot be both source and object in the same form; each term refers to a different stage.
  • A program that runs only inside the CPU cache: Cache is a hardware feature; it does not define whether code is source or object.


Common Pitfalls:
Some beginners confuse the words program and code and think there is no difference between source and machine code. Others may misread the question and pick all of the above because they associate program with any type of code. To avoid this, always remember that source is what the programmer writes and reads, while machine code is what the CPU executes. The translation step in between is the job of the compiler or assembler. Keeping this pipeline in mind makes the definition of source program easy to recall.


Final Answer:
A source program is a program written in a high-level or assembly language that is to be translated into machine language by a compiler or assembler.

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion