Anda di halaman 1dari 11

2.

Characteristics of a Good Algorithm:


 Finiteness: An algorithm should terminate
infinite number of steps in finite time.
 Definiteness: Each step of algorithm should
be clearly and precisely defined.
 Inputs: an algorithm should have finite
number of inputs.
 Effectiveness: An algorithm should be
effective.
 Indentation: Using indentation to write a
code makes the code look much better.
3. Basic symbols of a flowchart:
Computer assignment
(By Harshit Bansal- 18BCS3805)

1. Definition- A computer is a machine or device that


performs processes, calculations and operations based on
instructions provided by a software or hardware program.
Advantages of a computer:
 Increase your productivity
 Helps to organise things
 Introduces to the world of internet with limitless knowledge
 It is able to score large amount of data
 Save time by performing tasks quick
 Acts as an entertainment source by helping watch us movies,
listening songs etc.

2. Benefits of C over other languages in areas as follows:


 Used in Embedded systems as it is way easier to port a
compiler of C (high portability).
 It is a structured language so it is easy to break complex
program to simpler program, this reason enables it to be
preferred over other for systems programming.
 It is a mid-level language so it combines both features of
high and low-level languages, thus making it capable of
scripting drivers as well as software applications.
 C language is an open source software.
3. Different types of computing devices we see in day-to-day
life:
 Laptops are portable computers that include all the
features of a computer along with reasonably sized
battery.
 Calculators is very famous due to its ability to calculate
complex calculations in blink of eye.
 Digital watches are very common nowadays due to the
various features it can provide.
 Radio is fitted in every car due to its ability to play songs
without an internet connection.
 Desktops are there in very office to increase efficiency of
the work that is being given to the employees.

4. Overview of C:
C is a mid-level language that was originally developed by Dennis
Ritchie to develop the UNIX operating system at Bell Labs.
C has now become a widely used professional language.
Advantages of C:
 C is highly portable language. This means that C programs
written for one computer can easily run on another
computer without any change or by doing a little change.
 A C program is basically a collection of functions that are
supported by the C library this makes us easier to add our
own functions to C library.
 C language is a structured programming language. This
modular structure makes program debugging, testing and
maintenance easier.
 Several standard functions are available which can be used
for developing programs.
Disadvantages of C:
 There is no runtime checking in C language.
 It does not provide data security.
 Does not support reusability of source code.
 As the program extends it is very difficult to fix the bugs.

5. Advantages of modularization of code:


 Modularization allows multiple programmers to work on a
problem.
 Modularization allows you to reuse your work.
 Modular code is code that is highly organized. To organize
code based on task means that the programmer can
organize each piece of code based on what it does.
 Modular Code is easier to debug, easier to maintain and
easier to share will always run smoother with less errors.
This becomes necessary when working on extremely large
projects.

6. Definition- A programming language is a formal language


which comprises a set of instructions used to produce various
kinds of output.
Uses of programming language:
 Programming languages help convert what we want to
do into certain statements that the computer can
understand.
 computers are not magic, they are just very fast logic
machines that are very dumb until they are given very
detailed instructions.
7. High Level Languages are the machine independent
programming languages, which are easy to write, read, edit
and understand.
Advantages of high level language:
 They are written in human readable form, making them
programmer friendly.
 It is machine independent language.
 Less error prone, easy to find and debug errors.
 High level programming results in better programming
productivity.
Disadvantages of high level language:
 High level programs are comparatively slower than low
level programs.
 They are generally less memory efficient.
 A high-level language has to be translated into the
machine language by a translator, which takes up time
Low Level Languages are machine dependent programming
languages such as Binary language and Assembly language.
Advantages of Low level languages:
 Programs developed using low level languages are fast
and memory efficient.
 It can directly communicate with hardware devices.
 There is no need of any compiler or interpreters to
translate the source to machine code.
Disadvantages of Low level languages:
 It is difficult to develop, debug and maintain.
 Developed programs are machine dependent and are
not portable.
 Programs are more error prone.
 They exhibit poor programming productivity.
8. Difference between compiler, interpreter and assembler:

9.
 Standalone applications are those applications which can
work without an installation procedure and network
connection. These applications are platform dependent.

Examples: VLC media player, Adobe photoshop, Calculator


etc.

Languages used to develop: C, C++, C#


 Web based applications are those applications which
requires an internet connection to work. These applications
are platform independent.

Examples: YouTube, Facebook, Google drive etc.

Languages used to develop: Java, Python, HTML, XML

10.
Portability: The ability of a software to be transferred from
one machine or system to another.
 Code written in low level language is not portable
because they are designed to work in a particular CPU
architecture (i.e. 32 bit or 64 bit). Bit represent the
amount of data it can handle. 64-bit processor can
handle much more data more efficiently than the 32-bit
processor. The 64-bit machine writes a program in 64 bits
and that can’t run in 32 bits.

11.
Memory: Computer memory is any physical device capable of
storing information temporarily or permanently.
Types of Memory:
 Random Access Memory (RAM):
The primary storage is referred to as random access memory
(RAM) due to the random selection of memory locations. It
performs both read and write operations on memory. If power
failures happened in systems during memory access then you
will lose your data permanently.
 Read Only Memory (ROM):
ROM is permanent memory location that offer huge types of
standards to save data. But it works with read only operation.
No data lose happen whenever power failure occur during the
ROM memory work in computers.
 Cache: It is a high-speed access area that can be a reserved
section of main memory or on a storage device.

 Secondary Memory is external memory of the computer. It


is also known as Auxiliary memory and permanent memory.
It is used to store the different programs and the
information permanently. Secondary Memory is nature non-
volatile. It means data is stored permanently even if power
is switched off. For example: Floppy Disks, Hard Disk, Pen
Drive etc.

 Time to Access:
 RAM:
 DRAM – 50-150 nS
 SRAM – 10 nS
 ROM: 200-500 nS
 CACHE:7-50000 nS (Depends on the type of work)
 USB 3.0: 300-450 uS
 Hard Disk- 10-15 mS
 Memory Cost:
 RAM:
 DRAM – $0.03 per Mb
 SRAM – $7 per Mb
 ROM: $0.006 per Mb
 USB 3.0: $0.037 per Gb
 Hard Disk- $0.08 per Gb
12.
Bit: A bit is the smallest unit of data in a computer. A bit has a
single binary value, either 0 or 1. Although computers usually
provide instructions that can test and manipulate bits, they
generally are designed to store data and execute instructions
in bit multiples.
Byte: A byte is a unit of data that is eight binary digits long. A
byte is the unit most computers use to represent a character
such as a letter, number or typographic symbol. Each byte can
hold a string of bits that need to be used in a larger unit for
application purposes.

Binary Number System: The binary number system is a


numbering system that represents numeric values using two
unique digits (0 and 1). Mostly computing devices use binary
numbering to represent electronic circuit voltage state, (i.e.,
on/off switch), which considers 0 voltage input as off and 1
input as on. This is also known as the base-2 number system.

Decimal Number System: The number system that we use in


our day-to-day life is the decimal number system. Decimal
number system has base 10 as it uses 10 digits from 0 to 9. In
decimal number system, the successive positions to the left of
the decimal point represent units, tens, hundreds, thousands,
and so on. Each position represents a specific power of the
base (10).
 Reasons for using binary system in computer:
A computer basically is nothing but a bunch of electronic
switches that have two states; ON and OFF. If you think of
those two states as numbers, 0 for OFF and 1 for ON, you
have a base 2 numbering system, also called ‘binary’. These
can be grouped into various combinations, but still the
computer is basically a binary machine. There are
instructions built into the CPU that can treat the pattern of a
bunch of those switches as decimal numbers in some
computers, in others that is done with software. Other
number systems like octal, decimal has many operations for
different type of calculations to be carried out. Computer
does not have the ability to understand all of those by itself.
This is the reason computer works on Binary number system
rather than any other.
13. Converting 120 base 10 to base 2
Division Remainder
120/2 = 60 0
60/2 =30 0
30/2 =15 0
15/2 =07 1
07/2 =03 1
03/2 =01 1
01/2 = 00 1
Ans:
1 1 1 1 0 0 0

Converting ‘1111000’ base 2 to base 10


2^6
s 2^5 2^4 2^3 2^2 2 1
.
64
S
32 16 8 4 2 1
1S 1 1 1 0 0 0
S

= 64*1+32*1+16*1+8*1+4*0+2*0+1*0
= 64+32+16+8
=120

Anda mungkin juga menyukai