Hacking
Hacking
1.Hacking: The act of compromising digital devices and networks through unauthorized
access to an account or computer system.
Purpose: Hacking is usually done to gain unauthorized access to a computer system or a
computer network, either to harm the system or to steal sensitive information available on
the computer.
2.What is Programming?
A programming is a very natural and intuitive concept. A program is a series of statements
written in a specific language.
Computer only understands machine language. To instruct computer to do
something, the instructions must be written in its language.
Machine language is arcane and difficult to work with—it consists of raw bits and
bytes and is differ from architecture to architecture.
To overcome the complication of writing machine language is a translator.
o Assembler – is a program that translates assembly language into machine-
readable code.
o Compiler – converts a high-level language (C, C++, and Fortran) into machine
language.
High-level language is much more intuitive than assembly language and can be converted
into many different types of machine language for different processor architectures.
3.Pseudo-code
Programmers have yet another form of programming language called pseudo-code. It is
simply English arranged with a general structure similar to a high-level language. Or an
artificial and informal language that helps programmers develop algorithms.
Pseudocode is understood by the programmers of all types. It enables the programmers to
concentrate only on the algorithm part of the code development.
It cannot be compiled into an executable program.
Ex:
Java Code: if (i < 10) {i++;}
Pseudocode: if i is less than 10, increment i by 1.
4.Control Structures
Control structures are the blocks that analyze variables and choose directions in which to go
based on given parameters. Or CS are used to alter the flow of the program based on certain
conditions being met or not.
1|Page
Start out down main street headed east. Continue on Main Street until you see a church on your right. If the
street is blocked because of construction, turn right there at 15 th Street, turn left on Pine Street, and then turn
right on 16th Street. Otherwise, you can just continue and make a right on 16 th Street. Continue on 16th Street,
and turn left onto Destination Road. Drive straight down Destination Road for 5 miles, and then you’ll see the
house on the right. The address is 743 Destination Road. ( Examples are based on this paragraph)
i. If-Then-Else
Provides a secondary path of execution when an “if” clause evaluates to false.
Syntax:
If (condition) then
{
Set of instructions to execute if the condition is met;
}
Else
{
Set of instructions to execute if the condition is not met;
}
For this book C pseudo-code will be used.
Example:
Drive down the Main Street;
If (street is blocked) {
Turn right on 15th Street;
Turn right on Pine Street;
Turn right on 16th Street;
}
Else
Turn right on 16th Street;
ii. While/Until Loops
A while loop says to execute the following set of instructions in a loop while a condition is
true.
Example:
A simple program for a hungry mouse could look like this:
While (you are hungry) {
2|Page
Find some food;
Eat the food;
}
The set of two instructions following the while statement will be repeated while the mouse
is still hungry.
Another variation on the while loop is an until loop, a syntax that is available in the
programming language Perl (C doesn’t use this syntax)
An until loop is simply a while loop with the conditional statement inverted. The same
mouse program using an until loop would be:
Until (you are not hungry) {
Find some food;
Eat the food;
}
Any until-like statement can be converted into a while loop.
iii. For Loops
For loop is used when a programmer wants to loop for a certain number of iterations.
Example:
Drive straight down Destination Road for 5 miles could be converted to a for loop that looks
something like this:
For (5 iterations)
Drive straight for 1 mile;
A for loop is just a while loop with a counter. The same statement can be written as such:
Set the counter to 0;
While (the counter is less than 5) {
Drive straight for 1 mile;
Add 1 to the counter;
}
The C-like pseudo-code syntax of a for loop makes this even more apparent:
For (i=0; i<5; i++)
Drive straight for 1 mile;
3|Page
Using all of the control structures, the driving directions of the above paragraphs can be
converted into C-like pseudo-code that looks something like this:
Being going East on Main Street;
While (there is not a church on the right)
Drive down Main Street;
If (street is blocked) {
Turn right on 15th Street;
Turn left on Pine Street;
Turn right on 16th Street;
}
Else
Turn right on 16th Street;
Turn left on Destination Road;
For (i=0; i<5; i++)
Drive straight for 1 mile;
Stop at 743 Destination Road;
5.More Fundamental Programming Concepts
1. Variables
A variable can simply be thought of as an object that holds data that can be changed –
hence the name. There are also variables that don’t change, which are aptly called
constants. In C (and many other languages), variables must be declared and given type
before they can be used. Ultimately, all variables are stored in memory somewhere, and
their declarations allow the compiler to organize this memory more efficiently.
In C variable is given a type that describes the information that is meant to be stored in
that variable. Some of the most common types are:
int, float, and char.
Variables can be assigned values when they are declared or anytime afterward, using the
= operator.
Ex:
int a = 13, b;
float k;
char z = ‘A’;
4|Page
k = 3.14;
z = ‘w’;
b = a + 5;
2. Arithmetic Operators
i++ --- Increment the value of i by 1 after evaluating the arithmetic operation.
++i --- Increment the value of i by 1 before evaluating arithmetic operation.
Ex: int a = 5, b, c;
b = a++ * 6; // b value is 30
c = ++a * 6; // c value is 36
3. Comparison Operators
Condition Symbol Example
Less than < (a < b)
Greater than > (a > b)
Less than or equal to <= (a <= b)
Greater than or equal to >= (a >= b)
Equal to == (a == b)
Not equal to != (a != b)
5|Page
Comparison operator can also be chained together using shorthand for OR and AND.
6|Page