Chapter 1 - Introduction To Computers and Java - OL Academy
Chapter 1 - Introduction To Computers and Java - OL Academy
part1 - Hardware :
is a physical components of a computer such as CPU, Memory, Monitor, Printer, keyboard
and mouse.
part2 : Software:
is a set of instructions for the computer to follow, we called as program, such as Operating
System, Applications, Programming Language.
Part1 - Hardware :
It has four main categories: Processor(CPU), input devices, output devices, and Memory (Stor-
age).
2
1 - The processor
Also called central processing unit (CPU) : It’s act as the brain of the devices for proces-
ing and executing instructions.
1 - Memory
Memory holds programs, data for the computer to process, and the result of the computer’s inter-
mediate calculations. we have two kinds of memory: main memory and auxiliary memory.
- RAM is volatile, that means data will disappears when you shut down your computer.
3
Auxiliary Memory (Secondary memory):
The data in auxiliary memory exists even when the computer’s power is off, It is like a
various storage media on which a computer can stored data and programs.
4
5
Files
• It’s a large group of bytes in auxiliary memory (HDD or SSD).
• Files are organized into groups calles Folders, and each file have name.
• Java program are stored in files.
• We are copied Program files from auxiliary memory to main memory in order to be run.
6
Programming Languages:
- Java, C#, C++, Visual Basic, Python, Ruby are a high level languages.
- Computer hardware does not understand high level languages, can only deals with low level
langues, so must translate an program written with high level language to low level language.
- A compiler is a program that translates a program from a high level language to a low level
language.
- The Java compiler (javac) is a program that translates a java program into byte code.
- When a Java program is compiled, the byte code of the program has the same name, but end-
ing is changed from .java to .class.
- An interpreter is a program that alternates the translation and execution of satements in a pro-
gram written in a high level language. (translate each byte-code instruction into machine code)
- JVM (Java Virtual Machine) : translate the Java byte code to machine code.
- class Loader: The bytecode of various classes connected together to run the program.
7
1.2 A SIP OF JAVA
Applets: is a little application can be sent to another location on the internet and run there.
Some Terminology:
8
IDE (Integrated Development Enviroment ): Combines a text editor with commands for com-
piling and running Java programs.
}
9
1.3 PROGRAMMING BASICS
Some basics and helpful techniques that experienced programmers have found, they apply to
almost any programming Language.
10
Muliple Choice Questions:
1. This part of the computer fetches instructions, carries out the operations commanded by
the instructions, and produces some outcome or resultant information.
(A) Memory
(B) CPU
(C) secondary storage
(D) input device
11
5- It is a set of instructions for a computer to follow.
(A) Hardware
(B) Input
(C) Output
(D) Program
12
10- The file produced by the Java compiler contains _____________ that are executed by
the Java Virtual Machine.
(A) Bits
(B) Bytes
(C) Bytecode
(D) None of these
11- The information stored in _____________ typically is volatile, that means is disappears
when you shut down your computer.
(A) HDD
(B) SSD
(C) Main memory
(D) Auxiliary memory
13
15-Which type of program acts as an intermediary between a user of a computer and the
computer hardware?
(A) Operating system
(B) User thread
(C) Superuser thread
(D) Application program
17- The most basic circuitry-level computer language, which consists of 1 and 0, is _______.
(A) a high-level language
(B) machine language
(C) Java
(D) C++
14
19- Java programs can be executed in computer after
(A) converting them to bytecode
(B) converting them into machine code
(C) can be executed directly
(D) None of the above
20- The process of instructing the computer to solve a problem is called ___________.
(A) Compiling
(B) Programming
(C) Processing
(D) Controlling
21- When a Java program is compiled, the file produced by the compiler ends with the
________ file extension.
(A) .java
(B) .class
(C) .cpp
(D) .exe
22- ________ is a little application that is designed to be transmitted over the Internet and
run in a Web browser
(A) Application
(B) Applet
(C) Machine language
(D) Source code
28. Pseudocode is
(A) used to write an algorithm
(B) a machine language
(C) used to generate a byte code
(D) used to test a program
16
29. A syntax error _____________.
(A) is a grammatical mistake in your program
(B) is the same as a logical error
(C) cannot be discovered
(D) cannot be corrected
17