Executable file

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Executable file

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A compiler translates source code into an executable file. What does the executable file contain?
A Source code
B Machine code
2. Which statement about running an executable file is correct?
A The compiler must be installed to run it
B The compiler is not needed to run it
3. Mia runs a compiled program for the second time. What happens?
A It runs without being translated again
B It is translated again before every run
4. A student wants to give their finished game to friends but keep the code private. Which file should they share?
A The executable file
B The source code file
5. An executable file made for a Windows PC is copied to a different type of machine with a different processor. What is likely to happen?
A It may not run, because it is specific to one type of machine
B It will always run, because machine code works on every machine

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1game.exe ASend game.exe to users. Keep game.c private.
2gcc game.c -o game Bgame.exe made for a PC will not run on a phone
3A company gives customers only the executable file, so they can run the program without seeing the source code CAn executable file: the machine code program made by a compiler that the user can run directly
4An executable file is machine code for one type of machine, so it will not run on a different type of processor DAn executable file runs without the compiler, because it is already machine code and needs no translating again.
5The user must install the compiler to run game.exe each time EAn executable file is machine code, not source code. The source code is the separate file that the compiler translated.
6game.exe is the source code, so users can read and edit it FRuns the compiler to translate the source code once and produce an executable file called game

Definitions

executable file

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
source code -> compiler -> __________ file
2.
An executable file contains machine ____
3.
Run game.exe: translate again? __
4.
Give users the .exe, keep the ______ code
5.
An executable file is specific to one type of _______

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A source <- "game.c"
B exe <- INTERPRET(source)
C OUTPUT "Build finished"
Question 2
A IF compiler EXISTS THEN
B RUN exe
C ENDIF
Question 3
A exe <- COMPILE(source)
B SEND exe TO customer
C SEND source TO customer
Question 4
A source <- COMPILE(exe)
B RUN exe
C OUTPUT "Done"
Question 5
A exe <- COMPILE(source, "PC")
B RUN exe ON "Phone"
C OUTPUT "Works"

Answer Key

Executable file
Section A: Quick Questions
Q1
B — Machine code
Q2
B — The compiler is not needed to run it
Q3
A — It runs without being translated again
Q4
A — The executable file
Q5
A — It may not run, because it is specific to one type of machine
Section B: Match the Pairs
Q1
game.exe → An executable file: the machine code program made by a compiler that the user can run directly
Q2
gcc game.c -o game → Runs the compiler to translate the source code once and produce an executable file called game
Q3
A company gives customers only the executable file, so they can run the program without seeing the source code → Send game.exe to users. Keep game.c private.
Q4
An executable file is machine code for one type of machine, so it will not run on a different type of processor → game.exe made for a PC will not run on a phone
Q5
The user must install the compiler to run game.exe each time → An executable file runs without the compiler, because it is already machine code and needs no translating again.
Q6
game.exe is the source code, so users can read and edit it → An executable file is machine code, not source code. The source code is the separate file that the compiler translated.
Section C: Definitions
Q1
executable file — The machine code program a compiler produces. It runs without the compiler or source code, needs no re-translation, and works only on the type of machine it was made for.
Section D: Fill in the Blanks
Q1
source code -> compiler -> executable file
Q2
An executable file contains machine code
Q3
Run game.exe: translate again? no
Q4
Give users the .exe, keep the source code
Q5
An executable file is specific to one type of machine
Section E: Spot the Error
Q1
B — An executable file is the output of a compiler. An interpreter runs code line by line and does not produce an executable file. Line 2 should be exe <- COMPILE(source).
Q2
A — An executable file runs on its own, so the program only needs the executable to exist. It does not need the compiler. Line 1 should check for exe, not compiler.
Q3
C — An executable can be given to users without sharing the source code. Sending the source code defeats this. Line 3 should keep the source private.
Q4
A — The compiler takes the source code as input and produces the executable file as output. The line has them the wrong way round. It should be exe <- COMPILE(source).
Q5
B — An executable is machine code for one type of machine only. One compiled for a PC will not run on a phone, which has a different processor. Line 2 should run it on a PC.