Documente Academic
Documente Profesional
Documente Cultură
UNIT-I
Introduction to Computer Systems; Data representation: Number systems, character representation
codes, Binary, hex, octal codes and their inter conversions. Binary arithmetic, Floating point arithmetic,
signed and unsigned numbers IEEE standards, CPU organization, ALU, registers, memory, the idea of
program execution at micro level. Concept of computing, contemporary Operating Systems such as DOS,
Windows, UNIX etc. (only brief user level description). Introduction to organization and architecture of
mainframe, mini and micro systems.
UNIT-II
Concept of flow chart and algorithm; Algorithms to programs: specification, top-down development and
stepwise refinement ,Introduction to the design and implementation of correct, efficient and
maintainable programs, structured Programming, Use of high level programming language for the
systematic development of programs, programmability and programming languages, Object codes,
compilers. Introduction to the Editing tools such as vi or MS-VC editors.
Question No: (1) Define computers? Why computer is known as data processing system?
What are the basic operations of Computer?
Computer is a fast operating electronic device, which automatically accepts and store input data,
processes them and produces results under the direction of step by step program.
Any Process that uses a computer program will enter data and summarize, analyze or otherwise
convert data into usable information. The process may be automated and run on a computer.
It involves recording, analyzing, sorting, summarizing, calculating, disseminating and storing data. Thus
Computer is known as data processing system.
Answer: Data -Data is the fact or raw material for the information processing.
Information The processed data is called information.
Applications of computer
Word Processing
Internet
Desktop publishing
Digital video or audio composition
Mathematical Calculations
Robotics
Weather analysis
Characteristics of computers
Speed
Accuracy.
Automation.
Endurance.
Versatility.
Storage.
Cost Reduction.
Example:
Mainframe computer
Mainframes are computers used mainly by large organizations for critical applications, typically
bulk data processing such as census, industry and consumer statistics, enterprise resource planning,
and financial processing.
The term probably had originated from the early mainframes, as they were housed in enormous,
room-sized metal boxes or frames.
Mini computers:
A mini computer is a multi-user or time-sharing system. It is used for medium scale data processing such
as Bank account processing, Payroll processing etc., Mini computer process greater storage capacity and
larger memories as compared to micro computer.
Super computer
The fastest type of computer. Supercomputers are very expensive and are employed for specialized
applications that require immense amounts of mathematical calculations.
For example, weather forecasting requires a supercomputer. Other uses of supercomputers
include animated graphics, fluid dynamic calculations, nuclear energy research, and petroleum
exploration.
Question No: (4). Explain the fundamental units of a computer with a block diagram? Explain
the basic computer organization in detail?
Answer: A computer can process data, pictures, sound and graphics. They can solve highly
Complicated problems quickly and accurately.
Storage Unit:
The storage unit of the computer holds data and instructions that are entered through the
input unit, before they are processed. It preserves the intermediate and final results before these
are sent to the output devices. It also saves the data for the later use.
Memory Size:
All digital computers use the binary system, i.e. 0s and 1s. Each character or a number
is represented by an 8 bit code. The set of 8 bits is called a byte. A Character occupies 1
byte space. A numeric occupies 2 byte space. Byte is the space occupied in the memory. The
size of the primary storage is specified in KB (Kilobytes) or MB (Megabyte). One KB is
equal to 1024 bytes and one MB is equal to 1000KB. The size of the primary storage in a typical PC
usually starts at 16MB. PCs having 32 MB, 48MB, 128 MB, 256MB memory are quite common.
Output Unit:
The output unit of a computer provides the information and results of a computation to outside world.
Printers, Visual Display Unit (VDU) are the commonly used output devices. Other commonly used output
devices are floppy disk drive, hard disk drive, and magnetic tape drive.
Control Unit:
A PC may have CPU-IC such as Intel 8088, 80286, 80386, 80486, Celeron, Pentium, Pentium Pro, Pentium
II, Pentium III, Pentium IV, Dual Core, and AMD etc.
Answer: A number system is a set of rules and symbols used to represent a number. There are
several different number systems. Some examples of number systems are as follows:
Binary (base 2)
Octal (base 8)
Decimal (base 10)
Hexadecimal (base 16)
Decimal and Hexadecimal numbers can each be represented using binary values. This enables
decimal, hexadecimal, and other number systems to be represented on a computer which is based
around binary (0 or 1 / off or on). The base (or radix) of a number system is the number of units that is
equivalent to a single unit in the next higher counting space. In the decimal number system, the
symbols 0-9 are used in combination to represent a number of any sizes.
For example, the number 423 can be viewed as the following string of calculations:
(4 x 100) + (2 x 10) + (3 x 1) = 400 + 20 + 3 = 423
Limitations:
1)These computers were very big in size. The ENIAC machine was 30 x 50 feet in size and
30 tons in weight. So, these machines required very large space for their workings.
2)Their power consumption was very high.
3)These computers had slow operating speed and small computing capacity.
4)These computers had a very small memory.
Personal Computers:
A personal computer (PC) is a self-contained computer capable of input, processing, output, and
storage. A personal computer is designed to be a single-user computer and must have at least one input
device, one output device, a processor, and memory. The three major groups of PCs are desktop
computers, portable computers, and handheld computers. Desktop Computers: A desktop computer is
a PC designed to allow the system unit, input devices, output devices, and other connected
devices to fit on top of, beside, or under a users desk or table. This type of computer may be used in the
home, a home office, a library, or a corporate setting.
Portable Computers:
A portable computer is a PC small enough to be moved around easily. As the name suggests, a laptop
computer fits comfortably on the lap. As laptop computers have decreased in size, this type of
computer is now more commonly referred to as a notebook computer. Manufacturers recently
began introducing a new type of computer called the tablet PC, which has a liquid crystal display
(LCD) screen on which the user can write using a special-purpose pen, or stylus. Tablet PCs rely on
digital ink technology that allows the user to write on the screen. Another type of portable
computer, called a wearable computer, is worn somewhere on the body, thereby providing a user with
access to mobile computing capabilities and information via the Internet.
Handheld Computers:
An even smaller type of personal computer that can fit into the hand is known as a handheld computer
(also called simply handheld, pocket PC, or Palmtop). In recent years, a type of handheld
computer called a personal digital assistant (PDA) has become widely used for performing
calculations, keeping track of schedules, making appointments, and writing memos. Some
Workstations:
A workstation is a high-performance single-user computer with advanced input, output, and storage
components that can be networked with other workstations and larger computers. Workstations
are typically used for complex applications that require considerable computing power and high-
quality graphics resolution, such as computer-aided design (CAD), computer-assisted manufacturing
(CAM), desktop publishing, and software development.
Midrange Servers/Minicomputers:
Linked computers and terminals are typically connected to a larger and more powerful computer
called a network server, sometimes referred to as a host computer. Although the size and
capacity of network servers vary considerably, most are midrange rather than large mainframe
computers.
(ii) Terminal a device consisting of only a monitor and keyboard, with no processing
capability of its own.
Mainframe Computers:
Larger, more powerful, and more expensive than midrange servers, a mainframe computer is capable of
accommodating hundreds of network users performing different computing tasks. These computers
are useful for dealing with large, ever-changing collections of data that can be accessed by many users
simultaneously. Government agencies, banks, universities, and insurance companies use mainframes to
handle millions of transactions each day.
Supercomputers:
A supercomputer is the fastest, most powerful, and most expensive of all computers. Many are
capable of performing trillions of calculations in a single second. Primary applications include
weather forecasting, comparing DNA sequences, creating artificially intelligent robots, and
performing financial analyses.
Optical Drive
An optical drive uses lasers to store and read data on CDs and DVDs. It basically burns a series
of bumps and dips on a disc, which are associated with ones and zeros. Then, this same drive
can interpret the series of ones and zeros into data that can be displayed on your monitors. There are a
few different types of both CD and DVD disks, but the main two types include R and RW, which stand for
Recordable (but you can write information on it just once) and Rewritable (meaning you can record data
on it over and over again).
Question No: (8). Explain about memory in Computer System?(or) Write short notes on
memory of a computer?
Answer: The Role of Memory: The term "memory" applies to any electronic component capable of
temporarily storing data.
Auxiliary memory (also called physical memory or external memory) that stores information over
the long term, including after the computer is turned off. Auxiliary memory corresponds to magnetic
storage devices such as the hard drive, optical storage devices such as CD-ROMs and DVD-ROMs, as well
as read-only memories.
Technical Characteristics
(a) Capacity, representing the global volume of information (in bits) that the memory can
store
(b) Access time, corresponding to the time interval between the read/write request and the
availability of the data
(c) Cycle time, representing the minimum time interval between two successive accesses
(d) Throughput, which defines the volume of information exchanged per unit of time,
expressed in bits per second
(e) Non-volatility, which characterizes the ability of a memory to store data when it is not
being supplied with electricity
The ideal memory has a large capacity with restricted access time and cycle time, a high
throughput and is non-volatile. However, fast memories are also the most expensive. This is why
memories that use different technologies are used in a computer, interfaced with each other and
organized hierarchically. The fastest memories are located in small numbers close to the
processor. Auxiliary memories, which are not as fast, are used to store information permanently.
Types of Memories
Answer: Input/Output devices are required for users to communicate with the computer. In simple
terms, input devices bring information INTO the computer and output devices bring information
OUT of a computer system. These input/output devices are also known as peripherals since they
surround the CPU and memory of a computer system. Some commonly used Input/Output devices are
listed in table below.
(a)Keyboard
It is a text base input device that allows the user to input alphabets, numbers and other characters. It
consists of a set of keys mounted on a board.
AlphanumericKeypad: It consists of keys for English alphabets, 0 to 9 numbers, and special characters
like + / * ( ) etc.
FunctionKeys: There are twelve function keys labeled F1, F2, F3 F12. The functions assigned to these
keys differ from one software package to another. These keys are also user programmable keys.
Special-functionKeys
These keys have special functions assigned to them and can be used only for those specific purposes.
Functions of some of the important keys are defined below.
Enter-It is similar to the return key of the typewriter and is used to execute a command or program.
Spacebar-It is used to enter a space at the current cursor location.
Backspace-This key is used to move the cursor one position to the left and also delete the
character in that position.
Delete-It is used to delete the character at the cursor position.
Insert-Insert key is used to toggle between insert and overwrite mode during data entry.
Shift-This key is used to type capital letters when pressed along with an alphabet key. Also used to type
the special characters located on the upper-side of a key that has two characters defined on the
same key.
Caps Lock-Cap Lock is used to toggle between the capital lock features. When on, it locks the
alphanumeric keypad for capital letters input only.
Tab-Tab is used to move the cursor to the next tab position defined in the document. Also,it is used to
insert indentation into a document.
(b) Mouse
The mouse is a small device used to point to a particular place on the screen and select in order
to perform one or more actions. It can be used to select menu commands, size windows, start programs
etc. The most conventional kind of mouse has two buttons on top: the left one being used most
frequently.
Mouse Actions
(c) Joystick
The joystick is a vertical stick which moves the graphic cursor in a direction the stick is moved. It
typically has a button on top that is used to select the option pointed by the cursor. Joystick is used as
an input device primarily used with video games, training simulators and controlling robots
(d)Scanner
Scanner is an input device used for direct data entry from the source document into the computer
system. It converts the document image into digital form so that it can be fed into the computer.
Capturing information like this reduces the possibility of errors typically experienced during large
data entry. Hand-held scanners are commonly seen in big stores to scan codes and price information for
each of the items. They are also termed the bar code readers.
(f) Light Pen: It is a pen shaped device used to select objects on a display screen. It is quite like the mouse
(in its functionality) but uses a light pen to move the pointer and select any object on the screen by
pointing to the object. Users of Computer Aided Design (CAD) applications commonly use the
light pens to directly draw on screen.
(g) Touch Screen: It allows the user to operate/make selections by simply touching the display screen.
Common examples of touch screen include information kiosks, and bank ATMs.
(h)Digital camera: A digital camera can store many more pictures than an ordinary camera. Pictures taken
using a digital camera are stored inside its memory and can be transferred to a computer by
connecting the camera to it. A digital camera takes pictures by converting the light passing
through the lens at the front into a digital image.
Output Devices
(a) Monitor
Monitor is an output device that resembles the television screen and uses a Cathode Ray Tube (CRT) to
display information. The monitor is associated with a keyboard for manual input of characters and
displays the information as it is keyed in. It also displays the program or application output. Like the
television, monitors are also available in different sizes.
(c) Printer
Printers are used to produce paper (commonly known as hardcopy) output. Based on the technology
used, they can be classified as Impact or Non-impact printers. Impact printers use the typewriting
printing mechanism wherein a hammer strikes the paper through a ribbon in order to produce
(d) Plotter
Plotters are used to print graphical output on paper. It interprets computer commands and
makes line drawings on paper using multicolored automated pens. It is capable of producing
graphs, drawings, charts, maps etc. Computer Aided Engineering (CAE) applications like CAD
(Computer Aided Design) and CAM (Computer Aided Manufacturing) are typical usage areas for
plotters.
Answer: (10): Software:- Computer instructions or data, anything that can be stored electronically is
software. Computer software or just software is a general term used to describe the role that
computer programs, procedures and documentation in a computer system.
Hardware - (computer science) the mechanical, magnetic, electronic, and electrical components
making up a computer systemhardware. Hardware includes not only the computer proper but also the
cables, connectors, power supply units, and peripheral devices such as the keyboard, mouse, audio
speakers, and printers.
Instruction: An instruction is a basiccommand. The term instruction is often used to describe the
most rudimentaryprogramming commands. For example, a computer'sinstruction set is the
list of all the basic commands in the computer's machine language.
Register: A special, high-speed storage area within the CPU. All data must be represented in a
register before it can be processed. For example, if two numbers are to be multiplied, both
numbers must be in registers, and the result is also placed in a register.
(a) Individual application software refers to programs individuals use at work or at home. Examples
include word processing, spreadsheet, database management, and desktop publishing programs.
(b) Collaboration software (also called groupware) enables people at separate PC workstations to
work together on a single document or project, such as designing a new automobile engine.
(c) Vertical applicationsoftware is a complete package of programs that work together to perform core
business functions for a large organization. For example, a bank might have a mainframe computer at
its corporate headquarters connected to conventional terminals in branch offices, where they are
used by managers, tellers, loan officers, and other employees. All financial transactions are fed to the
central computer for processing. The system then generates managers reports, account statements,
and other essential documents.
Freeware: Freeware is software that is provided free of charge to anyone wanting to use it. Hundreds
of freeware programs are available, many written by college students and professors who create
programs as class projects or as part of their research.
Open Source Software: An open source software program is software whose programming code is
owned by the original developer but made available free to the general public, who is encouraged to
experiment with the software, make improvements, and share the improvements with the user
community
Question No (10): What do you understand by the compiler? What are various phases of compiler?
Lexical analysis This is the initial part of reading and analysing the program text: The text is read and
divided into tokens, each of which corresponds to a symbol in the programming language, e.g., a
variable name, keyword or number.
Syntax analysis This phase takes the list of tokens produced by the lexical analysis and arranges these in
a tree-structure (called the syntax tree) that reects the structure of the program. This phase is often
called parsing.
Type checking This phase analyses the syntax tree to determine if the program violates certain
consistency requirements, e.g., if a variable is used but not declared or if it is used in a context that does
not make sense given the type of the variable, such as trying to use a boolean value as a function
pointer.
Intermediate code generation The program is translated to a simple machine independent intermediate
language.
Register allocation The symbolic variable names used in the intermediate code are translated to
numbers, each of which corresponds to a register in the target machine code.
Machine code generation The intermediate language is translated to assembly language (a textual
representation of machine code) for a specic machine architecture.
Assembly and linking- The assembly-language code is translated into binary representation and
addresses of variables, functions, etc., are determined.
The rst three phases are collectively called the frontend of the compiler and the last three phases are
collectively called the backend. The middle part of the compiler is in this context only the intermediate
code generation, but this often includes various optimizations and transformations on the intermediate
code.
Each phase, through checking and transformation, establishes stronger invariants on the things it passes
on to the next, so that writing each subsequent phase is easier than if these have to take all the
preceding into account. For example, the type checker can assume absence of syntax errors and the
code generation can assume absence of type errors. Assembly and linking are typically done by
programs supplied by the machine or operating system vendor,
Question No (11): Explain working of Loader, Linker, Interpreter and Assembler?
B.TECH-I SEM/FOC/THEORITICAL NOTES ON UNIT-I AND II BY DHEERAJ MURARI Page 17
Answer: Loader: In a computer operating system, a loader is a component that locates a given program
(which can be an application or, in some cases, part of the operating system itself) in offline storage
(such as a hard disk), loads it into main storage (in a personal computer, it's called random access
memory), and gives that program control of the computer (allows it to execute its instruction s).
A program that is loaded may itself contain components that are not initially loaded into main storage,
but can be loaded if and when their logic is needed. In a multitasking operating system, a program that
is sometimes called a dispatcher juggles the computer processor's time among different tasks and
calls the loader when a program associated with a task is not already in main storage.
Linker: Also called link editor and binder, a linker is a program tha t combines object modules to form
an executable program. Many programming languages allow you to write different pieces of code,
called modules, separately. This simplifies the programming task because you can break a large program
into small, more manageable pieces. Eventually, though, you need to put all the modules together. This
is the job of the linker. In addition to combining modules, a linker also replaces symbolic addresses with
real addresses. Therefore, you may need to link a program even if it contains only one module.
The linkage editor accepts two major types of input:
Primary input, consisting of object decks and linkage editor control statements.
Additional user-specified input, which can contain both object decks and control
statements, or load modules. This input is either specified by you as input, or is incorporated
automatically by the linkage editor from a call library.
Interpreter: An interpreter normally means a computer program that executes, i.e. performs,
instructions written in a programming language. An interpreter may be a program that either
executes the source code directly
translates source code into some efficient intermediate representation (code) and
immediately executes this
explicitly executes stored precompiled code made by a compiler which is part of the
interpreter system
Assembler: An assembler translates an assembly language source program into machine codes.
Though the assembly language is the symbolic representation of machine codes, a computer
cannot understand it. After translating the assembly language program into machine codes by the
assembler, the program becomes ready for the execution.
2. Feasibility study:
After making an analysis in the system requirement the next step is to make analysis of the
software requirement. In other words feasibility study is also called as software requirement analysis.
In this phase development team has to make communication with customers and make analysis of
their requirement and analyze the system. By making analysis this way it would be possible to
make a report of identified area of problem. By making a detailed analysis on this area a
detailed document or report is prepared in this phase which has details like project plan or schedule of
the project, the cost estimated for developing and executing the system, target dates for each phase of
delivery of system developed and so on. This phase is the base of software development process
since further steps taken in software development life cycle would be based on the analysis
made on this phase and so careful analysis has to be made in this phase.
5. Testing:
A software or system which is not tested would be of poor quality. This is because this is the
phase where system developed would be tested and reports are prepared about bugs or errors in
system. To do this testing phase there are different levels and methods of testing like unit testing,
system test and so on. Based on the need the testing methods are chosen and reports are prepared
about bugs. After this process the system again goes to development phase for correction of errors and
again tested. This process continues until the system is found to be error free. To ease the testing
process debuggers or testing tools are also available.
Question No (13): Explain the steps involved in developing a program? (or) Brief
about planning the computer program?
A flow chart, or flow diagram, is a graphical representation of a process or system that details the
sequencing of steps required to create output. A flowchart is a picture of the separate steps of a process
in sequential order.
Advantages
Logic Flowcharts are easy to understand. They provide a graphical representation of actions to be
taken.
Logic Flowcharts are well suited for representing logic where there is intermingling among many
actions.
Disadvantages
Logic Flowcharts may encourage the use of GoTo statements leading to software design that is
unstructured with logic that is difficult to decipher.
Without an automated tool, it is time-consuming to maintain Logic Flowcharts.
Logic Flowcharts may be used during detailed logic design to specify a module.
However, the presence of decision boxes may encourage the use of GoTo statements, resulting in
software that is not structured. For this reason, Logic Flowcharts may be better used during Structural
Design.
Alterations and Modifications:If alterations are required the flowchart may require re-drawing
completely.
Reproduction:As the flowchart symbols cannot be typed, reproduction of flowchart becomes a
problem.
The essentials of what is done can easily be lost in the technical details of how it is done.
Properties of an algorithm
No ambiguity
There should not be any uncertainty about which instruction to execute next.
The algorithm should conclude after a finite number of steps.
The algorithm should be general.
Example:
Biggest among two numbers
Addition of N numbers
Finding Factorial of a number
Finding Fibonacci series.
Guidelines
Statements should be in simple English
Must produce a solution for the specified problem
It should be concise
Each instruction should be written in separate line and express one action.
Capitalize keywords such as READ, PRINT and so on.
Instruction should be written from top to bottom, with one entry and one exit.
Should allow easy transition from design to coding in programming language.
Benefits:
Language Independent.
Easy to develop a program from pseudo code than flowchart.
Easy to translate into programming language.
Limitations:
No visual representation of program logic
No accepted standards for writing pseudo codes.
Cannot be compiled or executed.
No real form or syntax rules.
Examples:
Finding a number is prime or not
QuestionNo(16): Define Operating System? What are functions and typesof operating System?
Answer: OPERATING SYSTEM: Operating System is a software that can be defined as:
An interface between users and hardware - an environment "architecture
Allows convenient usage; hides the tedious stuff
Allows efficient usage; parallel activity, avoids wasted cycles
Provides information protection
Gives each user a slice of the resources
Acts as a control program.
Functions of operating System:
An operting system manages hardware, runs applications, provides an interface for users, and
stores, retrieves, and manipulates files.
It manages the hardware and software resources of the system.
It provides a stable, consistent way for applications to deal with the hardware without having to
know all the details of the hardware.
A set of libraries or functions which may use to perform specific tasks especially relating to
interfacing with computer system components.
It avoids the situation of deadlock.
It is responsible for resource and performance optimization.
It manages process management and memory management
(e) COPY- Copies a file. Name of copy may be the same as original, or different.
Syntax: COPY [d:][path][name.ext] [d:][path][name.ext]
Optionalswitches:
/v Verify, copies the file and compares it with the original
/b Binary file
To copy a file from the root of C: to A: drive and change its name
A:\>COPY C:\MSDOS.SYS MSDOSSYS.BAK (from A:)
C:\>COPY MSDOS.SYS A:\MSDOSSYS.BAK (from the root of C:)
(l) PATH-The PATH command is used to help the command interpreter find external commands
which are not in the current directory. The command interpretter looks into the DOS
environment for "PATH=" and then searches the paths (each separated from the next by a
semicolon) that follow.
Syntax: PATH=[path;path;...]
To set the DOS PATH:
PATH=C:\DOS;C:\PCW;\C:\BIN
(m) SET PROMPT- Used to specify the appearance of the DOS prompt.
Syntax: SET PROMPT= (from the command line)
PROMPT= (in a batch file)
Someexamples:
(b) CHKDSK -Analyzes disk or diskette (first and only parameter) and displays disk and memory
status report.
Syntax: CHKDSK [d:] [/f] [/v]
Parameters: [d:] = Drive upon which to perform the checkdisk.
Optionalswitches:
/f Fix. Writes lost clusters to a disk file and corrects file allocation table.
/v Verbose. Lists all files on a disk.
Example:
(c) DISKCOPY-Makes an exact copy of a diskette, including hidden system files if they are present.
Syntax: DISKCOPY [d1:] [d2:]
Parameters:[d1:] = Drive for source diskette, [d2:] = Drive for target diskette.
Question No:(19): Explain Architecture of Unix? What are various Unix Commands?
Answer:- UNIXS is named after UNICS (UNiplexed Information and Computing Service). Its architecture
can be shown as below:
(1)UNIX Shell- Shell is an ordinary user program needs the ability to read from and write to the
terminal, and execute other programs, Commands may take arguments, which are passed to the
called program as character strings
All UNIX drivers are classified as either character device drivers (mouse, keyboard) or block
device drivers (disk)
Network device drivers (possible character devices, but handled very differently)
Process dispatching when interrupt happens, context switch happens between processes
Editors such as vi/emacs need raw tty
Shell is line oriented, hence uses cooked mode and line disciplines
Directories:File and directory paths in UNIX use the forward slash "/"
to separate directory names in a path.
examples:
/ "root" directory
/usr directory usr (sub-directory of / "root" directory)
/usr/STRIM100 STRIM100 is a subdirectory of /usr
ls list a directory
for example:
$ ls -l
drwxr-xr-x 4 cliff user 1024 Jun 18 09:40 WAITRON_EARNINGS
-rw-r--r-- 1 cliff user 767392 Jun 6 14:28 scanlib.tar.gz
^^ ^ ^ ^ ^ ^ ^ ^ ^ ^
|| | | | | | | | | |
| | | | | owner group size date time name
| | | | number of links to file or directory contents
| | | permissions for world
| | permissions for members of group
| permissions for owner of file: r = read, w = write, x = execute -=no permission
type of file: - = normal file, d=directory, l = symbolic link, and others...
ls -a List the current directory including hidden files. Hidden files start
with "."
ls -ld * List all the file and directory names in the current directory using long format. Without the "d"
option, ls would list the contents of any sub-directory of the current. With the "d" option, ls
just lists them like regular files.
chmod 755 file Changes the permissions of file to be rwx for the owner, and rx for the group and the
world. (7 = rwx = 111 binary. 5 = r-x = 101 binary)
chgrp user file Makes file belong to the group user.
chown cliff file Makes cliff the owner of file.
chown -R cliff dir Makes cliff the owner of dir and everything in its directory tree.
You must be the owner of the file/directory or be root before you can do any of these things.
Shells :The behavior of the command line interface will differ slightly depending on the shell program
that is being used.Depending on the shell used, some extra behaviors can be quite nifty.You can find out
what shell you are using by the command:
echo $SHELL
Of course you can create a file with a list of shell commands and execute it like a program to perform a
task. This is called a shell script. This is in fact the primary purpose of most shells, not the interactive
command line behavior.
Environment variables
You can teach your shell to remember things for later using environment variables.For example under
the bash shell:
Interactive History: A feature of bash and tcsh (and sometimes others) you can use the up-arrow keys to
access your previous commands, edit
them, and re-execute them.
Redirection:
The redirection directives, > and >> can be used on the output of most commands to direct their output
to a file.
Pipes:
The pipe symbol "|" is used to direct the output of one command to the input
of another.
For example:
ls -l | more This commands takes the output of the long format directory list command
"ls -l" and pipes it through the more command (also known as a filter).
In this case a very long list of files can be viewed a page at a time.
Command Substitution
You can use the output of one command as an input to another command in another way called
command substitution. Command substitution is invoked when by enclosing the substituted command
in backwards single quotes. For example:
which will cat ( dump to the screen ) all the files named aaa.txt that exist in the current directory or in
any subdirectory tree.
find . -name aaa.txt Finds all the files named aaa.txt in the current directory or
any subdirectory tree.
find / -name vimrc Find all the files named 'vimrc' anywhere on the system.
find /usr/local/games -name "*xpilot*"
Find all files whose names contain the string 'xpilot' which
exist within the '/usr/local/games' directory tree.
Often you will find archives of stuff with names like stuff.tar, or stuff.tar.gz. This
is stuff in a tar archive, and stuff in a tar archive which has been compressed using the
gzip compression program respectivly.
Chances are that if someone gives you a tape written on a UNIX system, it will be in tar format,
and you will use tar (and your tape drive) to read it.
Likewise, if you want to write a tape to give to someone else, you should probably use
tar as well.
Tar examples:
tar xv Extracts (x) files from the default tape drive while listing (v = verbose)
the file names to the screen.
tar tv Lists the files from the default tape device without extracting them.
tar cv file1 file2
Write files 'file1' and 'file2' to the default tape device.
tar cvf archive.tar file1 [file2...]
Create a tar archive as a file "archive.tar" containing file1,
file2...etc.
tar xvf archive.tar extract from the archive file
tar cvfz archive.tar.gz dname
Create a gzip compressed tar archive containing everything in the directory
'dname'. This does not work with all versions of tar.
tar xvfz archive.tar.gz
Extract a gzip compressed tar archive. Does not work with all versions of tar.
tar cvfI archive.tar.bz2 dname
Create a bz2 compressed tar archive. Does not work with all versions of tar
uncompress part.igs Uncompresseis part.igs from the compressed file part.igs.Z. Note the .Z
is not required.
Another common compression utility is gzip (and gunzip). These are the GNU compress and
uncompress utilities. gzip usually gives better compression than standard compress,
The bzip2 utility has (in general) even better compression than gzip, but at the cost of longer
times to compress and uncompress the files. It is not as common a utility as gzip, but is
becoming more generally available.
Example:
man ls Shows the manual page for the ls command
Example:
apropos build Shows a list of all the man pages whose descriptions contain the word "build"
Opening a file
vi filename
Creating text
Edit modes: These keys enter editing modes and type in the text
of your document.
Deletion of text
Oops
cursor positioning
^d Page down
^u Page up
:n Position cursor at line n
:$ Position cursor at end of file
^g Display current line number
h,j,k,l Left,Down,Up, and Right respectivly. Your arrow keys should also work if
if your keyboard mappings are anywhere near sane.
string substitution
These and other "special characters" (like the forward slash) can be "escaped" with \
i.e to match the string "/usr/STRIM100/SOFT" say "\/usr\/STRIM100\/SOFT"
These commands are all prefixed by pressing colon (:) and then entered in the lower
left corner of the window. They are called "ex" commands because they are commands
of the ex text editor - the precursor line editor to the screen editor
vi. You cannot enter an "ex" command when you are in an edit mode (typing text onto the screen)
Press <ESC> to exit from an editing mode.
Certain languages such as Ada, Pascal, and dBASE are designed with features that encourage or enforce
a logical program structure.
Structured programming frequently employs a top-down design model, in which developers map out
the overall program structure into separate subsections. A defined function or set of similar functions is
coded in a separate module or submodule, which means that code can be loaded into memory
more efficiently and that modules can be reused in other programs. After a module has been tested
individually, it is then integrated with other modules into the overall program structure.
Structured programming was first suggested by Corrado Bohm and Guiseppe Jacopini. The two
mathematicians demonstrated that any computer program can be written with just three structures:
decisions, sequences, and loops.
A top-down approach (also known as stepwise design) is essentially the breaking down of a system to
gain insight into its compositional sub-systems. In a top-down approach an overview of the system is
formulated, specifying but not detailing any first-level subsystems. Each subsystem is then refined in yet
greater detail, sometimes in many additional subsystem levels, until the entire specification is reduced
to base elements. A top-down model is often specified with the assistance of "black boxes", these make
it easier to manipulate. However, black boxes may fail to elucidate elementary mechanisms or be
detailed enough to realistically validate the model.
A bottom-up approach is the piecing together of systems to give rise to grander systems, thus making
the original systems sub-systems of the emergent system. Bottom-up processing is a type of information
processing based on incoming data from the environment to form a perception. Information enters the
eyes in one direction (input), and is then turned into an image by the brain that can be interpreted and
recognized as a perception (output). In a bottom-up approach the individual base elements of the
system are first specified in great detail. These elements are then linked together to form larger
subsystems, which then in turn are linked, sometimes in many levels, until a complete top-level system
is formed. This strategy often resembles a "seed" model, whereby the beginnings are small but
eventually grow in complexity and completeness. However, "organic strategies" may result in a tangle of
elements and subsystems, developed in isolation and subject to local optimization as opposed to
meeting a global purpose.
Answer:-The IEEE standard for floating point arithmetic:The IEEE (Institute of Electrical and Electronics
Engineers) has produced a standard for floating point arithmetic. This standard specifies how single
precision (32 bit) and double precision (64 bit) floating point numbers are to be represented, as well as
how arithmetic should be carried out on them.
The differences in the formats also affect the accuracy of floating point computations.
Single Precision:
The IEEE single precision floating point standard representation requires a 32 bit word, which may be
represented as numbered from 0 to 31, left to right. The first bit is the sign bit, S, the next eight bits are
the exponent bits, 'E', and the final 23 bits are the fraction 'F':
S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF
01 89 31
In particular,
0 00000000 00000000000000000000000 = 0
1 00000000 00000000000000000000000 = -0
The IEEE double precision floating point standard representation requires a 64 bit word, which may be
represented as numbered from 0 to 63, left to right. The first bit is the sign bit, S, the next eleven bits
are the exponent bits, 'E', and the final 52 bits are the fraction 'F':
S EEEEEEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
01 11 12 63
Question No:(18): Explain working of MS-VC editor? How you may run C program in MSVC?
Answer:-Microsoft Visual Studio C/C++ (MSVC), which has an integrated, colour coded editor, in the IDE
(Integrated Development Environment). This is editor-of-choice for generating C/C++ code ... since one
can make quick changes in the code, compile, and link the result, and quickly load it back into the
debugger for testing ... recently, it even allows code changes, while still in the debugger, and MSVC will
re-compile the particular module, and re-link the application.
You can compile a C program using command line or you can compile a C program using the Integrated
Development Environment (IDE) from Microsoft Visual C++.
1. Select [Start >> All Programs >> Microsoft Visual C++ 2010 Express Edition >> Visual Studio Tools >>
Visual Studio 2010 Command Prompt]. Run with administrator privileges.
2. Once you are in the command line, you can use any editor such as edit to write a C program.
4. During the compilation and linking, myprogram.obj and myprogram.exe will be created.To run the
program:
C:> myprogram
1. Create an empty project by select [File >> New >> Project]. Select [General >> Empty Project] and type
in the project name. Alternatively, you can select [File >> New >> Project], follow by [Win32 >> Win32
Console Application]. Type in the project name.
2. If you use Win32 Console Application, you can skip this step. Under [Solution Explorer], right click the
project name, and select [Properties]. Select [Configuration Properties >> Linker >> System]. Under
[SubSystem], select [Console (/SUBSYSTEM:CONSOLE)].
3. Under [Solution Explorer, Source File], right-click and select [Add >> New Item].
4. Under Code, Select C++ File (.cpp), however, when you type in the name use a program name with
extension .c, such as myprog.c and click [Add].
5. You can proceed to type your C program. Click [Save] icon to save your file.
6. To compile the program, under [Solution Explorer, Source File], right click the source file and select
[Compile or (Ctrl+F7)].
7. Please note that you cannot run the program until you have build solution.
9. To run the program without debugging, select [Debug >> Start without debugging or (Ctrl+F5)]. (Note:
If you do not have this option, you need to add the command manually under Tools >> Customize. You
may add a menu option or a button in the Debug toolbar.)
10. For any runtime error, you can debug the program as follows; Select [Debug >> Start debugging
(F5)].
11. Please note that during debugging, the program will show and close the console display
immediately.
12. To see the console display, you must run without debugging.
Note:
Under the project name of your program, the source code and object file is located at sub folder similar
to your project name, the executable file is under sub folder <Debug>.
It is simpler to use the command line to compile and run a C program, however, you could use the IDE
for writing a properly formatted C program.
[Also practice first 2 questions from all FOC question papers of last
three years of UTU]