Programming for Problem Solving E Balagurusamy pdf download
Programming for Problem Solving E Balagurusamy pdf download
https://ebookmass.com/product/programming-for-problem-
solving-e-balagurusamy/
https://ebookmass.com/product/problem-solving-and-python-programming-
e-balagurusamy/
https://ebookmass.com/product/computer-programming-e-balagurusamy/
Programming in C E. Balagurusamy
https://ebookmass.com/product/programming-in-c-e-balagurusamy/
https://ebookmass.com/product/programming-in-ansi-c-6th-edition-e-
balagurusamy/
Programming and Problem Solving with Python Ashok Namdev
Kamthane
https://ebookmass.com/product/programming-and-problem-solving-with-
python-ashok-namdev-kamthane/
https://ebookmass.com/product/python-programming-using-problem-
solving-approach-1st-edition-reema-thareja/
https://ebookmass.com/product/introduction-to-programming-with-java-a-
problem-solving-approach-3rd-edition-john-dean/
https://ebookmass.com/product/matlab-a-practical-introduction-to-
programming-and-problem-solving-4th-edition-stormy-attaway/
https://ebookmass.com/product/data-structures-e-balagurusamy/
PROGRAMMING
fOR
PRObleM SOlvING
Gujarat Technological University - 2018
About the Author
E Balagurusamy, is presently the Chairman of EBG Foundation, Coimbatore. In the past he has also held
the positions of member, Union Public Service Commission, New Delhi and Vice-Chancellor, Anna University,
Chennai. He is a teacher, trainer and consultant in the fields of Information Technology and Management.
He holds an ME (Hons) in Electrical Engineering and PhD in Systems Engineering from the Indian Institute
of Technology, Roorkee. His areas of interest include Object-Oriented Software Engineering, E-Governance:
Technology Management, Business Process Re-engineering and Total Quality Management.
A prolific writer, he has authored a large number of research papers and several books.
A recipient of numerous honors and awards, he has been listed in the Directory of Who's Who of Intellectuals
and in the Directory of Distinguished Leaders in Education.
PROGRAMMING
fOR
PRObleM SOlvING
Gujarat Technological University - 2018
E Balagurusamy
Chairman
EBG Foundation
Coimbatore
Information contained in this work has been obtained by McGraw Hill Education (India), from sources believed to be
reliable. However, neither McGraw Hill Education (India) nor its authors guarantee the accuracy or completeness of any
information published herein, and neither McGraw Hill Education (India) nor its authors shall be responsible for any errors,
omissions, or damages arising out of use of this information. This work is published with the understanding that McGraw
Hill Education (India) and its authors are supplying information but are not attempting to render engineering or other
professional services. If such services are required, the assistance of an appropriate professional should be sought.
Typeset at The Composers, 260, C.A. Apartment, Paschim Vihar, New Delhi 110 063 and printed at
Cover Printer:
Cover Designer: APS Compugraphics
Cover Image Source: Shutterstock
Visit us at: www.mheducation.co.in
Write to us at: info.india@mheducation.com
CIN: U22200TN1970PTC111531
Toll Free Number: 1800 103 5875
Preface
P
rogramming for Problem Solving requires a deep understanding of C. C is a powerful, flexible, portable
and elegantly structured programming language. Since C combines the features of high-level language
with the elements of the assembler, it is suitable for both systems and applications programming. It
is undoubtedly the most widely used general-purpose language today in operating systems, and embedded
system development. Its influence is evident in almost all modern programming languages. Since its
standardization in 1989, C has undergone a series of changes and improvements in order to enhance the
usefulness of the language.
Acknowledgements
I owe special thanks to the entire team of McGraw Hill Education India.
A note of acknowledgement is due to the following reviewers for their valuable feedback.
This book is my sincere attempt to make a footprint on the immensely vast and infinite sands of knowledge.
I would request the readers to utilize this book to the maximum extent.
E Balagurusamy
Publisher’s Note
McGraw Hill Education (India) invites suggestions and comments from you, all of which can be sent to info.
india@mheducation.com (kindly mention the title and author name in the subject line).
Piracy-related issues may also be reported.
Contents
Translator Programs 58
Problem-Solving Techniques 59
Using the Computer 70
Learning Outcomes 70
Key Concepts 71
Review Questions 73
Discussion Questions 84
2. Fundamentals of C 87
Learning Objectives 87
History of C 87
Importance of C 89
Sample Program 1: Printing a Message 89
Sample Program 2: Adding Two Numbers 92
Sample Program 3: Interest Calculation 93
Sample Program 4: Use of Subroutines 95
Sample Program 5: Use of Math Functions 96
Basic Structure of C Programs 97
Programming Style 98
Executing a ‘C’ Program 99
UNIX System 99
MS-DOS System 102
Key Concepts 102
Always Remember 103
Review Questions 103
Debugging Exercises 105
Programming Exercises 105
5. Functions 220
Learning Objectives 220
Introduction 220
Need for User-Defined Functions 221
A Multi-Function Program 221
Elements of User-Defined Functions 224
x Contents
6. Pointers 273
Learning Objectives 273
Introduction 273
Understanding Pointers 274
Accessing the Address of a Variable 276
Declaring Pointer Variables 277
Initialization of Pointer Variables 278
Accessing a Variable Through its Pointer 279
Chain of Pointers 281
Pointer Expressions 282
Pointer Increments and Scale Factor 284
Pointers and Arrays 284
Pointers and Character Strings 288
Array of Pointers 290
Pointers as Function Arguments 291
Functions Returning Pointers 294
Contents xi
7. Structure 311
Learning Objectives 311
Introduction 311
Defining a Structure 312
Declaring Structure Variables 313
Accessing Structure Members 315
Structure Initialization 316
Copying and Comparing Structure Variables 318
Operations on Individual Members 320
Arrays of Structures 320
Arrays within Structures 323
Structures within Structures 324
Structures and Functions 326
Unions 329
Size of Structures 330
Bit Fields 330
Key Concepts 333
Always Remember 333
Brief Cases 334
Review Questions 338
Debugging Exercises 341
Programming Exercises 341
Introduction to computer and programming: Introduction, Basic block diagram and functions of various
components of computer, Concepts of Hardware and software, Types of software, Compiler and interpreter,
Concepts of Machine level, Assembly level and high level programming, Flowcharts and Algorithms
Fundamentals of C: Features of C language, structure of C Program, comments, header files, data types,
constants and variables, operators, expressions, evaluation of expressions, type conversion, precedence
and associativity, I/O functions
GO TO Chapter 2 Fundamentals of C
Control structure in C: Simple statements, Decision making statements, Looping statements, Nesting of
control structures, break and continue, goto statement
Array & String: Concepts of array, one and two dimensional arrays, declaration and initialization of arrays,
string, string storage, Built-in-string functions
Recursion: Recursion, as a different way of solving problems. Example programs, such as Finding
Factorial, Fibonacci series, Ackerman function etc. Quick sort or Merge sort.
Functions: Concepts of user defined functions, prototypes, definition of function, parameters, parameter
passing, calling a function, recursive function, Macros, Pre-processing
GO TO Chapter 5 Functions
Pointers: Basics of pointers, pointer to pointer, pointer and array, pointer to array, array to pointer, function
returning pointer
GO TO Chapter 6 Pointers
Structure: Basics of structure, structure members, accessing structure members, nested structures, array
of structures, structure and functions, structures and pointers
GO TO Chapter 7 Structure
introduction
A computer is an electronic machine that takes input from the user, processes the given input and generates
output in the form of useful information. A computer accepts input in different forms such as data, programs
and user reply. Data refer to the raw details that need to be processed to generate some useful information.
Programs refer to the set of instructions that can be executed by the computer in sequential or non-
sequential manner. User reply is the input provided by the user in response to a question asked by the
computer.
A computer includes various devices that function as an integrated system to perform several tasks
described above (Fig. 1.1). These devices are:
Central Processing Unit (CPU)
It is the processor of the computer that is responsible for controlling and executing instructions in the computer.
It is considered as the most significant component of the computer.
2 Programming for Problem Solving
Monitor
It is a screen, which displays information in visual form, after receiving the video signals from the computer.
Keyboard and Mouse
These are the devices, which are used by the computer, for receiving input from the user.
Computers store and process numbers, letters and words that are often referred to as data.
l How do we communicate data to computers?
l How do the computers store and process data?
Since the computers cannot understand the Arabic numerals or the English alphabets, we should use
some ‘codes’ that can be easily understood by them.
In all modern computers, storage and processing units are made of a set of silicon chips, each contain-
ing a large number of transistors. A transistor is a two-state device that can be put ‘off’ and ‘on’ by passing
an electric current through it. Since the transistors are sensitive to currents and act like switches, we can
communicate with the computers using electric signals, which are represented as a series of ‘pulse’ and
‘no-pulse’ conditions. For the sake of convenience and ease of use, a pulse is represented by the code ‘1’
and a no-pulse by the code ‘0’. They are called bits, an abbreviation of ‘binary digits’. A series of 1s and
0s are used to represent a number or a character and thus they provide a way for humans and computers
to communicate with one another. This idea was suggested by John Von Neumann in 1946. The numbers
represented by binary digits are known as binary numbers. Computers not only store numbers but also
perform operations on them in binary form.
In this chapter, we discuss how the numbers are represented using what are known as binary codes, how
computers perform arithmetic operations using the binary representation, how digital circuits known as logic
gates are used to manipulate data, how instructions are designed using what are known as programming
languages and how algorithms and flow charts might help us in developing programs.
generations of computers
The history of computer development is often discussed in terms of different LO 1.1
generation of computers, as listed below. Identify the various
l First generation computers generations
l Second generation computers of computers
l Third generation computers
l Fourth generation computers
l Fifth generation computers
Introduction to Computer and Programming 3
The progress in LSI and VLSI technologies led to the development of microprocessor, which became the
major characteristic feature of the fourth generation
computers. The LSI and VLSI technology allowed
thousands of transistors to be fitted onto one small silicon
chip.
A microprocessor incorporates various components
of a computer—such as CPU, memory and Input/Output
(I/O) controls—onto a single chip. Some popular later
microprocessors include Intel 386, Intel 486 and Pentium.
Some of the examples of fourth generation computers
are IBM PC, IBM PC/AT, Apple and CRAY-1.
Advantages
l LSI and VLSI technologies made them small,
cheap, compact and powerful.
l high storage capacity
l highly reliable and required very less maintenance. Fig. 1.5 The Intel P4004 microprocessor chip
Introduction to Computer and Programming 5
l provided a user-friendly environment with the development of GUIs and interactive I/O devices.
l programs written on these computers were highly portable because of the use of high-level languages.
l very versatile and suitable for every type of applications.
l required very less power to operate.
Disadvantages
l the soldering of LSI and VLSI chips on the wiring board was complicated
l still dependent on the instructions given by the programmer.
Fifth generation computers are based on the Ultra Large Scale Integration (ULSI) technology that allows
almost ten million electronic components to be fabricated on one small chip.
Advantages
l faster, cheaper and most efficient computers till date.
l They are able to execute a large number of applications at the same time and that too at a very high
speed.
l The use of ULSI technology helps in decreasing the size of these computers to a large extent.
l very comfortable to use because of the several additional multimedia features.
l versatile for communications and resource sharing.
Disadvantage
They are not provided with an intelligent program that could guide them in performing different operations.
Figure 1.6 shows a tree of computer family that illustrates the area-wise developments during the last
four decades and their contributions to the various generations of computers.
classification of computers
Computers can be classified into several categories depending on their LO 1.2
computing ability and processing speed. These include Classify computers on
l Microcomputer the basis of different
l Minicomputer criteria
l Mainframe computers
l Supercomputers
Microcomputers
A microcomputer is defined as a computer that has a microprocessor as its CPU and can perform the
following basic operations:
l Inputting — entering data and instructions into the microcomputer system.
l Storing — saving data and instructions in the memory of the microcomputer system, so that they can
be use whenever required.
l Processing — performing arithmetic or logical operations on data, where data, such as addition,
subtraction, multiplication and division.
l Outputting — It provides the results to the user, which could be in the form of visual display and/or
printed reports.
l Controlling — It helps in directing the sequence and manner in which all the above operations are
performed.
Minicomputers
A minicomputer is a medium-sized computer that is more powerful than a microcomputer. It is usually
designed to serve multiple users simultaneously, hence called a multiterminal, time-sharing system.
6 Programming for Problem Solving
Minicomputers are popular among research and business organizations today. They are more expensive
than microcomputers.
Mainframe Computers
Mainframe computers help in handling the information processing of various organizations like banks,
insurance companies, hospitals and railways. Mainframe computers are placed on a central location and
are connected to several user terminals, which can act as access stations and may be located in the same
building. Mainframe computers are larger and expensive in comparison to the workstations.
Supercomputers
In supercomputers, multiprocessing and parallel processing technologies are used to promptly solve
complex problems. Here, the multiprocessor can enable the user to divide a complex problem into smaller
problems. A supercomputer also supports multiprogramming where multiple users can access the computer
simultaneously. Presently, some of the popular manufacturers of supercomputers are IBM, Silicon Graphics,
Fujitsu, and Intel.
Magnetic Magnetic
Tape Disk
Arithmetic
Unit
Control
Unit
CPU
Data and results flow
Control Instructions to units
Instructions to control unit
Fig. 1.7 Interaction among hardware components
8 Programming for Problem Solving
l Processor — Also known as CPU, it is used to perform the calculations and information processing
on the data that is entered through the input device.
l Output devices — They are used for providing the output of a program that is obtained after
performing the operations specified in a program. The examples of output devices are monitor and
printer.
l Memory — It is used for storing the input data as well as the output of a program that is obtained
after performing the operations specified in a program. Memory can be primary memory as well as
secondary memory. Primary memory includes Random Access Memory (RAM) and secondary
memory includes hard disks and floppy disks.
Software supports the functioning of a computer system internally and cannot be seen. It is stored on
secondary memory and can be an application software as well as system software. The application
software is used to perform a specific task according to requirements and the system software (operating
system and networking system) is mandatory for running application software.
input DeVices
LO 1.3
Input devices are electromechanical devices that are used to provide data
Describe the computer
to a computer for storing and further processing, if necessary. Depending
system
upon the type or method of input, the input device may belong to one of the
following categories:
Keyboard is used to type data and text and execute commands. A standard keyboard, as shown in Fig. 1.8,
consists of the following groups of keys:
Numeric Keypad looks like a calculator’s keypad with its 10 digits and mathematical operators.
Special Purpose Keys The special purpose keys help perform a certain kind of operation, like exiting a
program (Escape) or deleting some characters (Delete) in a document, etc.
Mouse is a small hand-held pointing device that basically controls the two-dimensional movement of the
cursor on the displayed screen. It is an important part of the Graphical User Interface (GUI) based Operating
Systems (OS) as it helps in selecting a portion of the screen and copying and pasting the text.
The mouse, on moving, also moves the pointer appearing on the display device (Fig. 1.9).
Wheel
Right Button
Left Button
processor
The CPU consists of Control Unit (CU) and ALU. CU stores the instruction set, which specifies the
operations to be performed by the computer. CU transfers the data and the instructions to the ALU for
10 Programming for Problem Solving
an arithmetic operation. ALU performs arithmetical or logical operations on the data received. The CPU
registers store the data to be processed by the CPU and the processed data also. Apart from CU and ALU,
CPU seeks help from the following hardware devices to process the data:
Motherboard
It refers to a device used for connecting the CPU with the input and output devices. The components on the
motherboard are connected to all parts of a computer and are kept insulated from each other. Some of
the components of a motherboard are:
l Buses: Electrical pathways that transfer data and instructions among different parts of the computer.
For example, the data bus is an electrical pathway that transfers data among the microprocessor,
memory and input/output devices connected to the computer.
l System clock: It is a clock used for synchronizing the activities performed by the computer. The
electrical signals that are passed inside a computer are timed, based on the tick of the clock.
l Microprocessor: CPU component that performs the processing and controls the activities performed
by the different parts of the computer.
l ROM: Chip that contains the permanent memory of the computer that stores information, which cannot
be modified by the end user.
RAM
It refers to primary memory of a computer that stores information and programs, until the computer is used.
RAM is available as a chip that can be connected to the RAM slots in the motherboard.
Video Card/Sound Card
The video card is an interface between the monitor and the CPU. Video cards also include their own RAM
and microprocessors that are used for speeding up the processing and display of a graphic. A sound card is
a circuit board placed on the motherboard and is used to enhance the sound capabilities of a computer.
output DeVices
The main task of an output device is to convert the machine-readable information into human-readable form
which may be in the form of text, graphics, audio or video.
A monitor produces visual displays generated by the computer. The monitor is connected to the video card
placed on the expansion slot of the motherboard.
The monitors can be classified as cathode ray tube (CRT) monitors or liquid crystal display (LCD)
monitors. The CRT monitors are large, occupy more space in the computer, whereas LCD monitors are thin,
light weighted, and occupy lesser space. Both the monitors are available as monochrome, gray scale and
color models.
A monitor can be characterized by its monitor size and resolution. The monitor size is the length of the
screen that is measured diagonally. The resolution of the screen is expressed as the number of picture
elements or pixels of the screen. The resolution of the monitor is also called the dot pitch. The monitor with a
higher resolution produces a clearer image.
The printer is an output device that transfers the text displayed on the screen, onto paper sheets that can
be used by the end user. Printers can be classified based on the technology they use to print the text and
images:
l Dot matrix printers — Dot matrix printers are impact printers that use perforated sheet to print the
text. Dot matrix printers are used to produce multiple copies of a print out.
l Inkjet printers — Inkjet printers are slower than dot matrix printers and are used to generate high
quality photographic prints.
l Laser printers — The laser printer may or may not be connected to a computer, to generate an
output. These printers consist of a microprocessor, ROM and RAM, which can be used to store the
textual information.
These systems record the simple messages in human speech form and then combine all these simple
messages to form a single message. The voice response system is of two types—one uses a reproduction
of human voice and other sounds, and the other uses speech synthesis.
The basic application of a voice output system is in Interactive Voice Response (IVR) systems, which are
used by the customer care or customer support departments of an organization, such as telecommunication
companies, etc.
memory management
The memory unit of a computer is used to store data, instructions for processing data, intermediate results
of processing and the final processed information. The memory units of a computer are classified as primary
and secondary memory. Computers also use a third type of storage location known as the internal process
memory. This memory is placed either inside the CPU or near the CPU (connected through special fast
bus).
The primary memory is available in the computer as a built-in unit of the computer. The primary memory is
represented as a set of locations with each location occupying 8 bits. Each bit in the memory is identified by
a unique address. The data is stored in the machine-understandable binary form in these memory locations.
The commonly used primary memories are as follows:
l ROM — ROM represents Read Only Memory that stores data and instructions, even when the
computer is turned off. It is the permanent memory of the computer where the contents cannot be
modified by an end user. ROM is a chip that is inserted into the motherboard. It is generally used to
store the Basic Input/Output system (BIOS), which performs the Power On Self Test (POST).
l RAM — RAM is the read/write memory unit in which the information is retained only as long as there
is a regular power supply. When the power supply is interrupted or switched off, the information stored
in the RAM is lost. RAM is volatile memory that temporarily stores data and applications as long as
they are in use. When the use of data or the application is over, the content in RAM is erased.
l Cache memory — Cache memory is used to store the data and the related application that was last
processed by the CPU. When the processor performs processing, it first searches the cache memory
and then the RAM, for an instruction. The cache memory can be either soldered into the motherboard
or is available as a part of RAM.
Introduction to Computer and Programming 13
Secondary memory represents the external storage devices that are connected to the computer. They
provide a non-volatile memory source used to store information that is not in use currently. A storage
device is either located in the CPU casing of the computer or is connected externally to the computer. The
secondary storage devices can be classified as:
l Magnetic storage device — The magnetic storage devices store information that can be read,
erased and rewritten a number of times. These include floppy disk, hard disk and magnetic tapes.
l Optical storage device — The optical storage devices are secondary storage devices that use laser
beams to read the stored data. These include CD-ROM, rewritable compact disk (CD-RW), digital
video disks with read only memory (DVD-ROM), etc.
l Magneto-optical storage device — The magneto-optical devices are generally used to store
information, such as large programs, files and back-up data. The end user can modify the information
stored in magneto-optical storage devices multiple times. These devices provide higher storage
capacity as they use laser beams and magnets for reading and writing data to the device.
System software consists of many different programs that manage and support different tasks. Depending
upon the task performed, the system software can be classified into two major groups (Fig. 1.15):
l System management programs used for managing both the hardware and software systems. They
include:
∑ Operating system
14 Programming for Problem Solving
∑ Utility programs
∑ Device drivers
l System development programs are used for developing and executing application software. These
are:
∑ Language translators
∑ Linkers
∑ Debuggers
∑ Editors
Application software includes a variety of programs that are designed to meet the information processing
needs of end users. They can be broadly classified into two groups:
l Standard application programs that are designed for performing common application jobs. Examples
include:
∑ Word processor
∑ Spreadsheet
∑ Database Manager
∑ Desktop Publisher
∑ Web Browser
l Unique application programs that are developed by the users themselves to support their specific
needs. Examples include:
∑ Managing the inventory of a store
∑ Preparing pay-bills of employees in an organization
∑ Reserving seats in trains or airlines
l Handles the working of application programs with the hardware and other software systems.
l Manages the storage and retrieval of information using storage devices such as disks.
Based on their capabilities and the types of applications supported, the operating systems can be divided
into the following six major categories:
l Batch operating system — This is the earliest operating system, where only one program is allowed
to run at one time. We cannot modify any data used by the program while it is being run. If an error
is encountered, it means starting the program from scratch all over again. A popular batch operating
system is MS DOS.
l Interactive operating system — This operating system comes after the batch operating system,
where also only one program can run at one time. However, here, modification and entry of data
are allowed while the program is running. An example of an interactive operating system is Multics
(Multiplexed Information and Computing Service).
l Multiuser operating system — A multiuser operating system allows more than one user to use a
computer system either at the same time or at different times. Examples of multiuser operating
systems include Linux and Windows 2000.
l Multi-tasking operating system — A multi-tasking operating system allows more than one program
to run at the same time. Examples of multi-tasking operating systems include Unix and Windows 2000.
l Multithreading operating system — A multithreading operating system allows the running of
different parts of a program at the same time. Examples of multithreading operating system include
UNIX and Linux.
l Real-time operating systems — These operating systems are specially designed and developed for
handling real-time applications or embedded applications. Example include MTOS, Lynx, RTX
l Multiprocessor operating systems — The multiprocessor operating system allows the use of
multiple CPUs in a computer system for executing multiple processes at the same time. Example
include Linux, Unix, Windows 7.
l Embedded operating systems — The embedded operating system is installed on an embedded
computer system, which is primarily used for performing computational tasks in electronic devices.
Example include Palm OS, Windows CE
MS DOS or Microsoft Disk Operating System, which is marketed by Microsoft Corporation and is one of the
most commonly used members of the DOS family of operating systems. MS DOS is a command line user
interface, which was first introduced in 1981 for IBM computers. Although MS DOS, nowadays, is not used
as a stand-alone product, but it comes as an integrated product with the various versions of Windows.
16 Programming for Problem Solving
In MS DOS, unlike Graphical User Interface (GUI)-based operating systems, there is a command line
interface, which is known as MS DOS prompt. Here, we need to type the various commands to perform
the operations in MS DOS operating system. The MS DOS commands can be broadly categorized into the
following three classes:
l Environment command — These commands usually provide information on or affects operating
system environment. Some of these commands are:
∑ CLS: It allows the user to clear the complete content of the screen leaving only the MS-DOS
prompt.
∑ TIME: It allows the user to view and edit the time of the computer.
∑ DATE: It allows the user to view the current date as well as change the date to an alternate date.
∑ VER: It allows us to view the version of the MS-DOS operating system.
l File manipulation command — These commands help in manipulating files, such as copying a file or
deleting a file. Some of these commands include:
∑ COPY: It allows the user to copy one or more files from one specified location to an alternate
location.
∑ DEL: It helps in deleting a file from the computer.
∑ TYPE: It allows the user to view the contents of a file in the command prompt.
∑ DIR: It allows the user to view the files available in the current and/or parent directories.
l Utilities — These are special commands that perform various useful functions, such as formatting a
diskette or invoking the text editor in the command prompt. Some of these commands include:
∑ FORMAT: It allows the user to erase all the content from a computer diskette or a fixed drive.
∑ EDIT: It allows the user to view a computer file in the command prompt, create and modify the
computer files.
Windows Architecture
The architecture of Windows operating system comprises a modular structure that is compatible with a
variety of hardware platforms. Figure 1.17 shows the architecture of Windows 2000; the later releases of
Windows operating systems are based on similar architecture.
At a high level, the architecture is divided into three layers, viz.
l User mode: Comprises application and I/O specific software components
l Kernel mode: Has complete access to system resources and hardware
l Hardware: Comprises underlying hardware platform
User Mode
The various subsystems in the user mode are divided into the following two categories:
l Environment subsystems: Comprise subsystems that run applications written for other operating
systems. These subsystems cannot directly request hardware access; instead such requests are
processed by virtual memory manager present in the kernel mode. The three main environment
subsystems include Win32, OS/2 and POSIX. Each of these subsystems possess dynamic link
libraries for converting user application calls to Windows calls.
l Integral subsystems: Takes care of the operating system specific functions on behalf of the
environment subsystems. The various integral subsystems include workstation service, server service
and security.
Introduction to Computer and Programming 17
Kernel Mode
The kernel mode comprises various components with each component managing specific system function.
Each of the components is independent and can be removed, upgraded or replaced without rewriting the
entire system. The various kernel-mode components include:
l Executive: Comprises the core operating system services including memory management, process
management, security, I/O, inter process communication etc.
l Kernel: Comprises the core components that help in performing fundamental operating system
operations including thread scheduling, exception handling, interrupt handling, multiprocessor
synchronization, etc.
l HAL: Acts as a bridge between generic hardware communications and those specific to the underlying
hardware platform. It helps in presenting a consistent view of system bus, DMA, interrupt controllers,
timers, etc. to the kernel.
l I/O manager: Handles requests for accessing I/O devices by interacting with the relevant device
drivers.
l Security reference monitor: Performs access validation and audit checks for Windows objects
including files, processes, I/O devices, etc.
l Virtual Memory Manager: Performs virtual memory management by mapping virtual addresses to
actual physical pages in computer’s memory.
l Process Manager: Creates and deletes objects and threads throughout the life cycle of a process.
l PnP manager: Supports plug-and-play devices by determining the correct driver for a device and
further loading the driver.
18 Programming for Problem Solving
l Power manager: Performs power management for the various devices. It also optimizes power
utilization by putting the devices to sleep that are not in use.
l GDI: Stands for Graphics Device Interface and is responsible for representing graphical objects in
Windows environment. It also transfers the graphical objects to the output devices such as printer and
monitor.
l Object manager: Manages Windows Executive objects and abstract data types that represent the
various resources such as processes, threads, etc.
UNIX operating system was developed by a group of AT&T employees at Bell Labs in the year 1969. UNIX
is primarily designed to allow multiple users access the computer at the same time and share resources.
The UNIX operating system is written in C language. The significant properties of UNIX include:
l Multi-user capability
l Multi-tasking capability
l Portability
l Flexibility
l Security
Architecture of UNIX
UNIX has a hierarchical architecture consisting of several layers, where each layer provides a unique
function as well as maintains interaction with its lower layers. The layers of the UNIX operating system are:
l Kernel
l Service
l Shell
l User applications
Figure 1.18 shows the various layers of the UNIX operating system.
l Kernel Kernel is the core of the UNIX operating system and it gets loaded into memory whenever
we switch on the computer. Three components of kernel are:
∑ Scheduler — It allows scheduling the processing of various jobs.
∑ Device driver — It helps in controlling the Input/Output devices attached to the computer.
∑ I/O buffer — It controls the I/O operations in the computer.
Various functions performed by the kernel are:
∑ Initiating and executing different programs at the same time
∑ Allocating memory to various user and system processes
∑ Monitoring the files that reside on the disk
∑ Sending and receiving information to and from the network
l Service In the service layer, requests are received from the shell and they are then transformed
into commands to the kernel. The service layer, which is also known as the resident module layer, is
indistinguishable from the kernel and consists of a collection of programs providing various services,
which include:
∑ Providing access to various I/O devices, such as keyboard and monitor
∑ Providing access to storage devices, such as disk drives
∑ Controlling different file manipulation activities, such as reading from a file and writing to a file
Introduction to Computer and Programming 19
User Applications
Shell
Service Layer
Kernel
Hardware
(Library Routines)
l Shell The third layer in the UNIX architecture is the shell, which acts as an interface between a user
and the computer for accepting the requests and executing programs. The shell is also known as the
command interpreter that helps in controlling the interaction with the UNIX operating system. The
primary function of the shell is to read the data and instructions from the terminal, and then execute
commands and finally display the output on the monitor. The shell is also termed as the utility layer as
it contains various library routines for executing routine tasks. The various shells that are found in the
UNIX operating system are:
∑ Bourne shell
∑ C shell
∑ Korn shell
∑ Restricted shell
l User applications The last layer in the UNIX architecture is the user applications, which are used to
perform several tasks and communicating with other users of UNIX. Some of the important examples
of user applications include text processing, software development, database management and
electronic communication.
ms worD
MS Word is application software that can be used to create, edit, save LO 1.6
and print personal as well as professional documents in a very simple and Discuss Microsoft software
efficient manner. MS Word is an important tool of the MS office suite that is
mainly designed for word processing. Other word processing applications
available are, Open Office Writer and Google Docs.
20 Programming for Problem Solving
For working in MS Word, we need to install MS Office in a computer system. After installing MS Office, we
can start MS Word by using any of the following two ways:
l Start menu
l Run command
We can start MS Word by performing the following steps using the Start menu:
1. Select Start Æ All Programs Æ Microsoft Office,
2. Select the Microsoft Office Word 2007 option to display the Graphical User Interface (GUI) of MS
Word, as shown in Fig. 1.19.
Using Run command We can also start MS Word by performing the following steps using the Run
command:
1. Select Start Æ All Programs Æ Accessories Æ Run to display the Run dialog box.
2. Type winword in the Open text box and click OK to display the Document1 – Microsoft Word window.
The following are the key operations that we can perform in MS Word:
l Creating a document
l Saving a document
l Editing a document
l Formatting a document
l Printing a document
Introduction to Computer and Programming 21
ms eXcel system
MS Excel is an application program that allows us to create spreadsheets, which are represented in the form
of a table containing rows and columns. The horizontal sequence in which the data is stored is referred to as
a row. The vertical sequence in which the data is stored is referred to as a column. In a spreadsheet, a row
is identified by a row header and a column is identified by a column header. Each value in a spreadsheet
is stored in a cell, which is the intersection of rows and columns. A cell can contain either numeric value
or a character string. We can also specify the contents of a cell using formulas. In a spreadsheet, we can
perform various mathematical operations using formulas, such as addition, subtraction, multiplication,
division, average, percentage, etc.
MS Excel also allows us to represent the complex data pictorially in the form of graphs. These are
generally used to represent the information with the help of images, colours, etc., so that their presentation
is simple and more meaningful. Some of the graphs available in spreadsheet are bar graphs, line graphs,
3-D graphs, area graphs, etc.
For working with MS Excel, we first need to install MS Office in our computer system. After installing MS
Office, we can start MS Excel using any of the following two ways:
l Start menu
l Run command
Using Start menu We can start MS Excel by performing the following steps using the Start menu:
1. Select Start Æ All Programs Æ Microsoft Office, as shown in Fig. 1.20.
2. Select the Microsoft Office Excel 2007 option to display the GUI of MS Excel,
Figure 1.20 shows the initial workbook of MS Excel, which in turn contains worksheets. Each worksheet
contains rows and columns where we can enter data.
Using Run command We can also start MS Excel by performing the following steps using the Run
command:
1. Select Start Æ All Programs Æ Accessories Æ Run to display the Run dialog box.
2. Type excel in the Open text box and click OK to display the Microsoft Excel – Book1 window.
Worksheet is the actual working area consisting of rows and columns. The worksheets are also known as
the spreadsheets. A workbook in MS Excel is a combination of several worksheets. Each workbook of MS
Excel contains three worksheets by default. The key operations that are performed in MS Excel include:
l Creating a worksheet
l Saving a worksheet
l Modifying a worksheet
l Renaming a worksheet
l Deleting a worksheet
l Moving a worksheet
l Editing a worksheet
ms powerpoint system
MS PowerPoint is a software application included in the MS Office package that allows us to create
presentations. PowerPoint provides a GUI with the help of which we can create attractive presentations
quickly and easily. The presentation may include slides, handouts, notes, outlines, graphics and animations.
A slide in PowerPoint is a combination of images, text, graphics, charts, etc., that is used to convey some
meaning information. The presentations in MS PowerPoint are usually saved with the extension .ppt.
The interface of MS PowerPoint is similar to the other interfaces of MS Office applications. PowerPoint
presentations are commonly used in business, schools, colleges, training programmes, etc.
For working in MS PowerPoint, we need to first install the MS Office package in our computer system. After
installing MS Office, we can start MS PowerPoint using any of the following two ways:
l Start menu
l Run command
Using Start menu We can start MS PowerPoint by performing the following steps using the Start menu:
1. Select Start Æ All Programs Æ Microsoft Office,
2. Select the Microsoft Office PowerPoint 2007 option to display the GUI of MS PowerPoint, as shown in
Fig. 1.21.
Using Run command We can also start MS PowerPoint by performing the following steps using the Run
command:
1. Select Start Æ All Programs Æ Accessories Æ Run to display the Run dialog box.
2. Type powerpnt in the Open text box and click OK to display the Microsoft PowerPoint –
[Presentation1] window.
Introduction to Computer and Programming 23
The following are the key operations that can be performed in MS PowerPoint:
l Creating a new presentation
l Designing the presentation
l Saving a new presentation
l Adding slides to the presentation
l Printing the presentation
networking concepts
Computer network is a system of interconnected computers that enable LO 1.7
the computers to communicate with each other and share their resources, Know various networking
data and applications. The physical location of each computer is tailored to concepts and protocols
personal and organisational needs. A network may include only personal
computers or a mix of PCs, minis and mainframes spanning a particular
geographical area. Computer networks that are commonly used today may be classified as follows:
l Based on geographical area:
∑ Local Area Networks (LANs)
∑ Wide Area Networks (WANs)
∑ Metropolitan Area Networks (MANs)
∑ International Network (Internet)
∑ Intranet
24 Programming for Problem Solving
LAN is a group of computers, as shown in Fig. 1.22, that are connected in a small area such as building,
home, etc. Through this type of network, users can easily communicate with each other by sending and
receiving messages. LAN is generally used for connecting two or more personal computers through some
medium such as twisted pair, coaxial cable, etc. Though the number of computers connected in a LAN is
limited, the data is transferred at an extremely faster rate.
WAN is a group of computers that are connected in a large area such as continent, country, etc. WAN
is generally used for connecting two or more LANs through some medium such as leased telephone
lines, microwaves, etc. In WAN, data is transferred at slow rate. A typical WAN network is shown in Fig. 1.23.
MAN is a network of computers that covers a large area like a city. The size of the MAN generally lies
between that of LAN and WAN, typically covering a distance of 5 km to 50 km. The geographical area
covered by MAN is comparatively larger than LAN but smaller than WAN. MAN is generally owned by
private organisations. MAN is generally connected with the help of optical fibres, copper wires etc. One of
the most common example of MAN is cable television network within a city as shown in Fig. 1.24. A network
device known as router is used to connect the LANs together. The router directs the information packets to
the desired destination.
Introduction to Computer and Programming 25
network topologies
Network topology refers to the arrangement of computers connected in a network through some physical
medium such as cable, optical fibre etc. Topology generally determines the shape of the network and the
communication path between the various computers (nodes) of the network. The various types of network
topologies are as follows:
l Hierarchical topology
l Bus topology
26 Programming for Problem Solving
l Star topology
l Ring topology
l Mesh topology
l Hybrid topology
The hierarchical topology is also known as tree topology, which is divided into different levels connected
with the help of twisted pair, coaxial cable or fibre optics. Figure 1.25 shows the arrangement of computers
in hierarchical topology.
In the linear bus topology, all the nodes are connected to the single backbone or bus with some medium
such as twisted pair, coaxial cable, etc. Figure 1.26 shows the arrangement of computers in the linear bus
topology.
Advantages of linear bus topology are:
l The linear bus topology usually requires less cabling.
l The linear bus topology is relatively simple to configure and install.
l In the linear bus topology, the failure of one computer does not affect the other computers in the
network.
Introduction to Computer and Programming 27
In the star topology, all the nodes are connected to a common device known as hub. Nodes are connected
with the help of twisted pair, coaxial cable or optical fibre. Figure 1.27 shows the arrangement of computers
in star topology.
Advantages of star topology are:
l This topology allows easy error detection and correction.
l In the star topology, the failure of one computer does not affect the other computers in the network.
l Star topology is easy to install.
The following are the disadvantages of star topology:
l In the star topology, the hub failure leads to the overall network crash.
l The star topology requires more amount of cable for connecting the nodes.
l It is expensive due to the cast of hub.
In the ring topology, the nodes are connected in the form of a ring with the help of twisted pair. Each node is
connected directly to the other two nodes in the network. Figure 1.28 shows the arrangement of computers
in the ring topology.
28 Programming for Problem Solving
In mesh topology, each computer is connected to every other computer in point-to-point mode as shown in
Fig. 1.29. If we have n computers, we must
have n(n – 1)/2 links.
Advantages of mesh topology are:
l Message delivery is more reliable.
l Network congestion is minimum due to
large number of links.
The following are the disadvantages:
l It is very expensive to implement.
l It is very difficult to configure and install.
Network protocols are the set of rules and regulations that are generally used for communication between
two networks. Using network protocol, the following tasks can be performed:
l Identification of the type of the physical connection used
l Error detection and correction of the improper message
l Initiation and termination of the communication session
l Message formatting
Some of the commonly used network protocols are Hyper Text Transfer protocol (HTTP), Simple Mail
Transfer Protocol (SMTP), File Transfer Protocol (FTP), Transmission Control Protocol/Internet Protocol
(TCP/IP), Telecommunications Network (Telnet), Domain Name System (DNS) etc.
30 Programming for Problem Solving
HTTP
Hyper Text Transfer Protocol (HTTP) is the communication protocol used by the World Wide Web. It acts as
a request-response protocol where the client browser and the Web server interact with each other through
HTTP protocol rules. These rules define how messages are formatted and transmitted and what actions
should the browser and Web server take in response to these messages. For example, when we type a
URL in the address bar of a browser, then an HTTP request is sent to the Web server to fetch the requested
Web page. The Web page details are transmitted to the client browser and rendered on the browser window
through HTML.
In a typical situation, the client browser submits an HTTP request to the server and the server processes
the request and returns an HTTP response to the client. The response contains status information pertaining
to the request as well as the requested content (Figs 1.31–1.32).
Fig. 1.31 HTTP Request Message format Fig. 1.32 HTTP Response Message format
HTTP protocol supports various methods that are used by the client browsers to send request messages
to the server. Some of the common HTTP methods are:
l GET: Gets information from the specified resource
l HEAD: Gets only the HTTP headers
l POST: Posts information to the specified resource
l DELETE: Deletes the specified resource
l OPTIONS: Returns the list of HTTP methods that are supported by the Web server
l TRACE: Returns a diagnostic trace of the actions taken at the server end
The first line in an HTTP response object comprises a status line, which carries the response status code
indicating the outcome of the HTTP request processed by the server. The status code is a 3-digit number
and carries specific meaning, as described below:
l 1xx: Comprises information status messages indicating that the server is still processing the request
l 2xx: Comprises success status messages indicating that the request was received, accepted and
processed by the server
l 3xx: Comprises redirection status messages indicating that further action needs to be taken in order to
process the request
l 4xx: Comprises error status messages indicating error at client side, for example incorrect request
syntax
l 5xx: Comprises error status messages indicating error at server side, for example inability of the
server to process the request
SMTP
Simple Mail Transfer Protocol (SMTP) is an e-mail protocol that is widely used for sending e-mail messages
between mail servers. While SMTP supports capabilities for both sending and receiving e-mail messages,
e-mail systems primarily used SMTP protocol for sending e-mail messages. For receiving, they use other
protocols such as POP3 of IMAP. In Unix-based systems, sendmail is the most widely used SMTP server for
e-mail. In Windows-based systems, Microsoft Exchange comes with an SMTP server and can be configured
to include POP3 support.
Introduction to Computer and Programming 31
FTP
File Transfer Protocol (FTP) is a standard protocol used for sharing files over the Internet. FTP is based
on the client-server architecture and uses Internet’s TCP/IP protocol for file transfer. The users need to
authenticate themselves by specifying user name/password in order to establish a connection with the
FTP server. However, some FTP sites also support anonymous login where users are not required to enter
their credentials. To facilitate secure transfer of user’s credentials and file contents over the Internet, FTP
encrypts the content using cryptographic protocols such as TLS/SSL.
The following steps illustrate how file transfer happens through FTP:
1. The client machine uses Internet to connect to the FTP server’s IP address.
2. User authentication happens by entering relevant user name and password.
3. Once the connection is established, the client machine sends FTP commands to access and transfer
files. Now-a-days, various GUI-based FTP software are available that enable transfer of files through
simple operations, such as drag and drop.
Telnet
Telnet is a protocol that allows users to connect to remote computers over a TCP/IP network, such as
intranet or internet. While HTTP and FTP protocols are used for transferring Web pages and files over the
Internet, the Telnet protocol is used for logging onto a remote computer and performing operations just as a
normal user. The users need to enter their credentials before logging on the remote host machine.
Command-line based telnet access is available in major operating systems such as Windows, Mac OS,
Unix and Linux. Generic format of the telnet command is given below:
Telnet host port
Here,
l telnet: Is the command that establishes telnet connection
l host: Is the address of the host machine
l port: Is the port number on which telnet services are available on the host machine
Decimal system
The decimal system is the most common number system used by human beings. It is a positional number
system that uses 10 as a base to represent different values. Therefore, this number system is also known
as base10 number system. In this system, 10 symbols are available for representing the values. These
symbols include the digits from 0 to 9. The common operations performed in the decimal system are
addition (+), subtraction (–), multiplication (×) and division (/).
The decimal system can be used to represent both the integer as well as floating point values. The
floating point values are generally represented in this system by using a period called decimal point.
The decimal point is used to separate the integer part and the fraction part of the given floating point
number. However, there is no need to use a decimal point for representing integer values. The value of any
number represented in the decimal system can be determined by first multiplying the weight associated with
each digit in the given number with the digit itself and then adding all these values produced as a result of
multiplication operation. The weight associated with any digit depends upon the position of the digit itself in
the given number. The most common method to determine the weight of any digit in any number system is
to raise the base of the number system to a power that initially starts with a 0 and then increases by 1 as we
move from right to left in the given number. To understand this concept, let us consider the following floating
point number represented in the decimal system:
Other documents randomly have
different content
Wir sind gespannt; aber der Dichter bricht ab. Wir müssen mit ihm
rasch übers Meer, nach Belmont, zur Kästchenwahl. Der Prinz von
Arragonien trifft seine Wahl. Silber: „Wer mich erwählt, bekommt so
viel, als er verdient.“ Wir sind schon höher oben; schon ist eine
Beziehung da zwischen Entscheidung und innerem Wesen des
Wählenden; bedächte der Prinz nur, daß wer seines eigenen
Verdienstes selber sicher sein will, es ermessen muß an seiner
eigenen Hingabe und Opferfähigkeit! Denn freilich, was das Urteil
über den Wert der andern angeht, was haben wir eher zu fragen, als
ob sie ihr Amt verdienen? Da sagt er in einer der sentenziösen
Reden, die in Porzias Reich an ihrer Stelle sind, schon prachtvolle
Dinge; im Objektiven, im Kritischen paßt er hierher:
Und so wählt er als Selbstgerechter, wie mancher Mann, der sich nur
darum für würdig hält und nur so zur Entscheidung schreitet, daß er
sich besser weiß als die meisten andern. So aber kann Porzia nie die
Seine werden; so darf er nie um ein Weib freien. Er geht; und nun
wird Bassanio gemeldet; und wir sind begierig, Antonios Freund von
uns aus nah kennen zu lernen; noch haben wir ihn kaum im Ernste
gesehen. Ist er der, dem Porzia zuteil werden darf? Ist er der, um
dessentwillen die Gefahr Antonio näher und näher rücken darf?
So kehren wir nach Venedig zurück; wir kennen nun schon den
Aufbau des Stücks: der Kreis, in dessen Mitte Shylock sich bäumt,
soll erst durch Bassanio zu Porzias Reich in Beziehung gesetzt
werden, bis diese zur Rettung verkleidet aufbrechen muß, um den
Unhold zu überwinden. Einstweilen werden die einen und die andern
Dinge getrennt von einander fortgeführt und jeweils wieder
abgebrochen. Heiter ernst, sinnig bedeutsam geht es in Belmont zu;
mit Wirklichkeiten so nah gequält, wie dort mit Märchenhaftem ins
Ferne und Allgemeine entrückt, sind wir auf den Straßen Venedigs.
Jetzt hören wir — zu Beginn des dritten Aktes — Schreckhaftes von
Antonios Verlusten; zugleich aber, nun wir ahnen, was kommen
kann, reckt sich Shylock gewaltig in die Höhe: hier, an dieser Stelle,
spricht der Jude, der Nichts-als-Jude, der Repräsentant seines
Volkes, der Erbe, der alle Unterdrückung, Mißhandlung,
Beschimpfung und Schmach in seinem vergifteten Blute kochen
fühlt. Und dazu der neue Grund: seine Tochter, seine Dukaten; und
die neue, o, gewiß, seit der Jugendzeit die erste Hoffnung für diesen
Mann, die nichts mit Besitzgier zu tun hat: die Rache, mit der er
phantastisch gespielt hat, könnte zu wirklichem Ernst werden! Und
in einander verfilzt empfindet der Unselige den fast körperlichen
Schmerz bei Tubals Nachrichten von der Tochter und das Jauchzen
seines Herzens bei den Mitteilungen über Antonios gefährdete Lage;
und schon empfinden wir voraus, wie er das Messer, das ihm jetzt
durchs Herz fährt — Antonio aber hat es gewetzt, Antonio ist ihm
der Führer des Kreises, aus dem Lorenzo kam —, wie er es wollüstig
grausam gegen Antonio wenden wird. Das Traurigste an diesem aus
der Welt, aus Licht und Sonne der Gemeinschaft und der Achtung
verstoßenen Mann ist doch vielleicht, daß er auch aus seinem
eigenen Herzen gestoßen ist, daß er in seinen eigenen Motiven nicht
eindeutig, nicht sicher ist. Sein Verstand kennt sich in seinen Trieben
nicht aus, sie mißleiten einander gegenseitig, er steht keineswegs
immer rein in der Rache; er hegt den gewinnsüchtigen
Nebengedanken: Wenn Antonio — durch juridischen Mord — aus
dem Wege geräumt ist, „so kann ich Handel treiben, wie ich will“.
Und wieder die Verwandlung, wieder hin nach Belmont, und diesmal
ganz besonders von Nacht zu Licht. Das ist die große Bassanioszene.
Beide, Porzia und Bassanio, erleben jetzt ihre Steigerung ins Hohe.
Sie haben wir bisher fast nur von der anmutig klaren, neckisch
heiteren Seite kennen gelernt; und in der Art, wie ihre Liebe sich
jetzt von vornherein verrät, fehlt das dunkle, trübende Element der
Leidenschaft: die herzliche Innigkeit äußert sich in der Form des
hellen Geistes; das Wunderseltene geschieht, daß Wärme und Licht
beisammen sind. So drückt sich denn in all diesen Belmontszenen
die Handlung in der Form der schönen, zur Wohlredenheit
gewandelten Sprache aus; immer, wenn Shakespeare die höchste
Sphäre gestaltet, werden wir nicht mehr durch ausbrechende Natur
bis ins Mark hinein erschüttert, der Trieb geht in Geist, die Aktion in
Sprache, die Sprache in Musik über. So tritt denn auch hier diese
letzte Steigerung hinzu; während Bassanio in inniger Versenkung,
kaum hoffend, daß er der Berufene sei, im vollen Gefühl der
repräsentativen Bedeutung des Augenblicks, mit sich zu Rate geht,
wohin er seine Entscheidung schlagen soll, ertönt auf Porzias Geheiß
im Hintergrund Musik, und eine Frauenstimme, vom Chor begleitet,
singt ein Lied.
Eben die Frage, die Porzia aufgibt. Wir müssen sie aber noch in
Shakespeares Original vernehmen; Schlegel hat hier nicht alles zum
Ausdruck bringen können:
Fancy: die Einheit von Liebe, Lust, Laune und Phantasie — das ist
das Reich, in dem wir bei Porzia sind.
Man macht, da es so überaus schön wäre, diese entscheidende
Stelle in deutscher Schönheit ohne Minderung des Sinns zu
vernehmen, den Versuch, den Beginn dieses Lieds von der Wiege
der Liebe sich von dem modernen Verbesserer Schlegels, von
Gundolf singen zu lassen, der mit feierlich abweisender Gebärde so
anspruchsvoll auftritt, — und fällt in den Abgrund:
Antonio faßt sich dann; er weiß, das Recht muß seinen Lauf haben;
was sollte aus der großen Handelsstadt Venedig werden, wenn die
Fremden nicht die Gewähr hätten: hier wird streng nach dem
geschriebenen Recht, nach dem Wortlaut der Verträge gerichtet?
Und überdies: lebenssatt war er schon immer; sei’s drum! Ihm liegt
nur noch daran, daß der Freund sieht: er tritt bis zum letzten, mit
seinem Leben, für ihn ein. Nun, wo die Not da ist, kann auch er der
ziellos melancholische, passive Mann, sich einem einzigen, dem
Freunde, hingeben.
Wir sind — ich wage es zu sagen — in einer wohligen Spannung.
Selbst wenn wir nicht jeden Teil des Stückes aus dem Ganzen heraus
empfingen, zum Beginn und zur Mitte schon das Ende dazu nähmen,
selbst wenn wir wären, wie wir uns immer wieder spielend anstellen:
solche, die den Verlauf allererst kennen lernen, — selbst dann
wüßten wir aus der immer, regelmäßig dazwischen tretenden Einkehr
in Porzias Reich: das Äußerste darf, kann nicht geschehen; Traum,
Geist und Spiel müssen zur rechten Zeit kommen und die
Wirklichkeit der Affekte verscheuchen; das Wort muß kommen, die
menschliche Rede, die Redelichkeit — wie man im Mittelalter die
Ratio nannte —, und muß sieghaft über dem Trieb, dem Schein, dem
Buchstaben stehen. Und schon sind wir wieder in Belmont und von
sanfter, heiterer Hoffnung erfüllt: Porzia mit Nerissa bricht in
Männerkleidung auf nach Venedig. Und auch nachher noch bleiben
wir eine Szene weiter in Belmont; wir kommen in Porzias Garten; wir
hören aus dem Mund der erwachenden und wachsenden Jessika, die
aus dem nächtigen Haus ins Reich des Lichts verpflanzt worden ist,
Porzias höchstes Lob:
Shylock kennt kein solches Muß, und mit der Verstandeslogik der
Herzensdummheit fragt er, was oder wer ihn zwingen solle, vom
Recht zu lassen.
So aber war’s nicht gemeint; o nein, da hast du schon recht;
äußerlich kann dich nichts zur Gnade zwingen. Gnade ist eine Gabe;
man ist begnadet, wenn man Gnade üben kann.
Darum, Jude,
Suchst du um Recht schon an, erwäge dies,
Daß nach dem Lauf des Rechtes unser keiner
Zum Heile käm’: wir beten all um Gnade,
Und dies Gebet muß uns der Gnade Ta t e n
Auch ü b e n lehren.
Porzia selbst mit ihrem Geist anmutiger Natur ist solch eine
Begnadete, wie Shylock ein Enterbter ist; und Bassanio hat sie
erringen dürfen, weil er die Entscheidung getroffen hat, zu geben,
von Herzen zu geben, und sein Alles dran zu wagen.
Aber gleich hebt wieder die Hölle an, die Pein ist kaum mehr zu
ertragen; das scharfgewetzte Messer bohrt sich gegen uns wie
gegen Antonio; und er, um dessen Leben es geht, spricht aus, was
wir empfinden:
die Melodie der Teufelei mitten in sich selbst umbiegt und sich,
obwohl sie ihre Tonfolge beibehält, rhythmisch verwandelt; denn
hier, bei diesem von Porzia auf die Spitze getriebenen Recht, spüren
wir: da spielt überlegener Geist mit dem, der im wütigen Ernst und
doch dabei im kalten Formalismus des Rechts über die Grenzen des
Menschenmöglichen zu gehen vermag: der Teufel der
Buchstabengrausamkeit soll an sich selbst scheitern, soll durch sich
besiegt werden: dem Rechtsanspruch soll sein Recht werden; der
Frauengeist, der hier mit der männischen Wut ringt, die die Maske
männlicher Logik angenommen hat, trägt diese nämliche Maske
virtuos; aber so wie hinter Shylocks Logik der Haß steckt, so birgt
sich in des Rechtsgelehrten Logik Porzias frauenhafte
Liebesentscheidung. Und schon hier, vor der letzten glücklichen
Wendung, taucht leise, von fern, durchs Gewittergrollen hindurch,
die Stimme des Scherzes, der neckischen Lustigkeit auf.
Antonio nimmt mit herzergreifenden Worten seinen Abschied von
Bassanio, für dessen Glück er jetzt geopfert werden soll: Empfehlt
mich Eurem edlen Weib...
Da wird in einem kurzen Quintett ein aus Ernst und Spiel wunderbar
gemischtes Zwischensätzchen eingelegt: Bassanio und Graziano
beteuern in leidenschaftlichem Ausdruck der Freundschaft, vor der,
wo der Freund in Gefahr ist, alles, alles andre versinken muß, sie
würden Leben, Weib und alle Welt opfern, um Antonio zu retten;
Porzia und Nerissa — der Richter und der Schreiber — machen heiter
böse Bemerkungen dazu, wie nur sie selbst und wir sie verstehen,
und Shylock, dessen Ghettoseele nichts über die Familie geht, fügt
seine Stimme ein mit Haß und Verachtung gegen solche
Christenmänner und Christenehen und mit seinem Jammer um die
Tochter, die in jenes Lager gelaufen ist.
Und dann kommt die große Wendung, durch Heiterkeit vorbereitet,
und sie ist Heiterkeit, wie sie der Liebe entstammt: ein Pfund Fleisch,
nicht mehr, kein Tröpfchen Blut.
Wundervoll, wie der überlegene Intellekt Shylocks gleich versteht,
was er in der Sprache des Gemüts so gar nicht begriffen hatte: der
Interpretation seines eignen Gesetzes fügt er sich sofort; mit seinem
Schein und dessen Wortlaut hatte er Antonio in die Schlinge gelockt;
jetzt hat ein Geist, der noch heller ist als seiner, das Opfer aus der
Schlinge befreit. Sein Geld möchte er noch haben; er begehrt es
kleinlaut; wie er’s nicht bekommen kann, will er nichts als nach
Hause gehn. Er hat morden wollen und darf am Leben bleiben;
bleibt auch vor Entblößung bewahrt; daß er zur Taufe gezwungen
wird, ist eine Konzession dieser Gestalten Shakespeares oder auch
des Dichters selbst an die Zeit, seinen Spaßmacher aber hat er
schon im voraus darüber spotten lassen; und von der ganz andern
Taufe mit heilig seligem Geist, auf die es dem Dichter ankommt,
vernehmen wir erst im Finale. In der Art aber, wie Shylock abgeht
und aus dem Stück verschwindet, liegt Größe: nichts hier von
äußerlicher Tragik, nichts von Mord und Totschlag oder Selbstmord
oder auch nur einer jammervoll pathetischen Rede: er ist vernichtet,
ist völlig zu nichts geworden und geht still nach Hause. Er ist nicht
wohl; wir glauben es ihm; er wird dahinsterben.
Wenn der Erlöser in die Hölle herniederstiege, oder wenn bei einem
Erwachen der Menschen die Uhren alle den Tag ankündigten, die
Sonne aber wollte nicht kommen und Nacht lagerte lange Stunden
lang, man vermeint, für immer über der Erde, und nun dränge
überwältigend der erste Lichtstrahl hervor: von der Art ist das Gefühl
der Erleichterung, das uns und die Venezianer bei Porzias
Richterspruch überkommt. Da brauchen wir wahrlich nicht als
erheiterndes Nachspiel den ernsthaften Streit der juristischen
Doktoren über das Recht, das diese Frau gesprochen hat; die
Heiterkeit, Amor, amor dei intellectualis hat hier zu Recht erkannt.
Die Heiterkeit ist damit, daß zwei Frauen aus fernem Land kamen
und den Graus verjagten, daß die Männer, gar noch die eigenen
Männer, nichts merkten, auf die Bühne getreten; was soll der Streit,
ob tragisch oder komisch? Hier wird dargestellt, auf welchen Geistes
Wegen unter Menschen die Tragik zu Lust wird. Wie haben sich alle
Elemente der zuvor so getrennten Handlung an dieser Gerichtsstätte
aufs schönste, aufs ungezwungenste vereinigt! In fancy, in Lust und
Liebe und Laune hat sich nun alles Düstere und Lastende aufgelöst;
und Laune, Leichtsinn und Neckerei, im Verein mit Verklärung und
Liebe, bilden darum den Schluß. Noch im Gerichtssaal und dann
sofort nachher auf der Straße leiten Porzia und Nerissa die lustige
Art ein, wie sie sich ihren Männern zu erkennen geben wollen: ein
bißchen müssen die doch im Ernst dafür gestraft werden, daß sie in
leidenschaftlicher Inbrunst bereit waren, ihr Alles, diesmal aber nicht
bloß ihr Eigen, auch ihre Frauen daran zu wagen, um den Freund zu
erretten. So müssen sie den Rettern, die kein anderes Zeichen der
Dankbarkeit annehmen, die Ringe, die sie von ihren Frauen haben
und nie von der Hand lassen sollen, schenken. Der letzte Satz der
Symphonie wird so vorbereitet, der ein wundersames Scherzo ist, ein
Scherzo molto cantabile e serafico. Sweet Shakespeare, der süße,
der holde Dichter hat ihn gedichtet. Nach dieser befreienden
Erlösung war nur eine Steigerung noch möglich: mit dem letzten
Sinn des Stückes in den verschwimmenden Duft des Allgemeinen, in
die Einheit von Seele und Geist, von Herz und Kopf, von Geist und
Natur. Von diesem Naturgeistgefühl sind wir nun in der
Gartenlandschaft von Belmont sofort umfangen; wir sind in der
höchsten, reinsten Geistersphäre. Nacht; Mondschein; Musik ertönt.
Lorenzo und Jessika walten als Gäste der noch abwesenden
Gebieterin im Haus. Von beider Sinn ist in dieser Landschaft des
Geistes wie ein einengender Reifen gesprungen; sie waren
leichtfertig bis zur Frivolität; die Leichtigkeit haben sie bewahrt und
das Spielerische, aber nun sind sie der erniedrigenden Umgebung
der Zwecke und Mittelchen ledig, sie brauchen nicht mehr gegen die
Gemeinheit reagieren; sie sind schwärmerisch und begeistert
geworden. In der Art der Wechselgesänge des Volks, mit
Erinnerungen an die heitere Fabelwelt der antiken Mythologie
sprechen sie einander im Duett jugendlich frei und leicht ihre Liebe
und Freude zu, und dann kommt von Lorenzos Lippen der
wundervolle Hymnus auf die Musik; Herder hat nichts Schöneres und
Tieferes seinen „Stimmen der Völker in Liedern“ als Motto mitgeben
können:
ist mir die ergreifend schönste Stelle der ganzen Dichtung. Das ist
Jessikas wahre Taufe im Geist; das ist der Aufstieg der Tochter
Shylocks aus der Entwürdigung des Ghetto, im Flug über alle
geschichtlich relativen Stufen hinweg, zur Höhe der vom Geist
beflügelten, im Geist einigen Menschheit. Wie sie noch auf den
Straßen Venedigs war und nur im Maskenfest die glühende Fackel
der Liebe schwang, da war noch Schlacke genug in ihr wie in ihrem
fröhlich-leichtsinnigen Liebsten; aber jetzt sind sie in Belmont, sind
drüben, sind droben: da ist keine Rede mehr von Assimilation und
solchen Nebengedanken aus der Relativität und Anpassung; sie ist
von Shylock weg zu Porzia gebracht worden: mit Lorenzo zusammen
ist sie in das Reich der Freiheit und des Geistes aufgenommen
worden.
Und nun folgt eben die Stelle von dem Manne, der, solange er in
seinen Kotleib eingesperrt ist, drunten und draußen bleiben muß,
von dem Manne, der nicht Musik hat in ihm selbst, der also, wir
haben es jetzt eben vernommen, nicht am Himmel, am Ewigen, an
der Unsterblichkeit im Leben schon teil hat.
Wie man diese Worte, die durch ihren Anschluß an die Stelle von der
Sphärenmusik der Himmelsgestirne und unsterblichen Seelen so klar
sein sollten, nicht hat verstehen können, wie sie nicht zur Erkenntnis
des wahren Sinns und Zusammenhangs der Dichtung geleitet haben,
ist schwer zu fassen. Aber selbst Friedrich Theodor Vischer, gewiß
nicht der erste beste, aber freilich eine tragikomische Mischung aus
Dichter, freiem Denker und Philister, nimmt die Worte als
gelegentlich eingeflochtene Sentenz zum Lob der Musik, so nach Art
von „Wer nicht liebt Wein, Weib und Gesang...“ und fügt, zu seinen
Hörern gewandt, schnurrig-knurrig hinzu: „Ist wohl etwas stark, und
Sie könnten vielleicht auch sagen ungerecht, aber desto
unzweifelhafter ist damit seine große Liebe zur Musik dargetan.“ Ach
ja —!
Während die Musik immer weiterspielt, treten im Hintergrund Porzia
und Nerissa auf. Porzia sieht zwischen den Bäumen das Licht vom
Hause her schimmern und spricht als erstes Wort, das wir bei ihrer
Rückkehr von der Rettungsreise von ihr hören, einen der sinnend
seelenvollen Sätze, die den Kern der Dichtung treffen; denn so
wortgewaltig in dem Teil der Dichtung, der um Shylock herum die
Triebe zur Handlung bringt, die Leidenschaften auftreten, so
handlungsmächtig und handlungdeutend sind in Porzias Teil die
Worte; sie sagt:
Die Art aber, wie das nun bekannt wird, was sie Großes getan hat,
führt zu keiner Ruhmesverherrlichung und zu einer Beschämung der
Männer nur in neckischem Spiel. Wir sind in dem Geisterreich der
Freiheit, wo Seele und anmutiger, nur durch die Grazie in Schranken
gehaltener Witz beisammen sind, und wir brauchen die lässig frohe
Abspannung nach der hohen Spannung so nötig. Die bekommen wir
in dem Nachspiel mit den Ringen; hier ist der fortwährende
Doppelsinn der Reden nicht tragische Ironie, sondern Lust: wir
Zuschauer sind ja eingeweiht und lassen die Männer da droben
vergnüglich eine Weile zappeln. So wird denn keck genug — die
Gatten mußten sich ja um Antonios willen vor ihrer
Liebesvereinigung trennen — mit dem Liebesakt Scherz getrieben:
nie kommst du in mein Bett, bis ich den Ring habe (ich hab’ ihn ja
schon); oder gar: ich nehme den Richter in mein Bett (freilich, ich
bin’s ja selber).
Noch ein tieferer Sinn aber scheint mir in der Heiterkeit und der Art,
wie hoher Geist sich hier auf den Wegen fröhlichen Spieles dem
Alltag nähert, zu liegen: wie könnten die andern alle, die noch gar
kein Recht auf dieses Reich haben, die alle noch fehlbare oder
oberflächliche und übermütig-verwegene Menschen sind, die nichts
zur Rettung gewußt haben, wie könnten sie gedemütigt sein von der
Hoheit dieser Frau, in der Natur und Geist sich zur Schönheit
verbunden haben! Aber des Höllengrauses wird nun höchstens noch
mit leisen Hindeutungen gedacht: es wird alles in Freude und Liebe
und Spiel, in fancy verwandelt.
Sofern wir reif sind für die Landung in Belmont, wo bohrend
tiefgreifende Losungen und Spaltungen aus unsrer wie Shakespeares
Zeit keine Geltung haben, reif für seine feste Härte und
hochfliegende Liebe, so bringt uns kaum ein andres Stück
Shakespeares zu so persönlicher Dankbarkeit gegen den Dichter, der
recht von Herzen nachsichtig und gütig gegen uns allesamt gewesen
ist, gleichviel, wer wir sind. Wir empfinden dann: hat er Bassanio,
Antonio, Lorenzo, Jessika, Graziano und Menschen noch minderen
Grades eingelassen, so hat er auch uns die Pforte nicht zugesperrt.
Wir sind es, wir, denen Shylocks Wut und Marterschrei nachtönt, wir
sind es, die weiter leben, gedeihen und wachsen müssen wie dürfen,
obwohl der Alte an uns verdorben ist und an uns, wie ein
verwundetes Tier, das sich verkrochen hat, dahinstirbt, wir sind all
diese Gut-Schlechten, Lustigen, Schwermütigen, Wankenden,
Wandelbaren; wir — ob Männer ob Frauen, ob Juden ob Christen,
zumal aber das junge Volk — wir dürfen in Arbeit und Spiel unser
selbst harren und auf das Reich hoffen, das Reich der gebundenen
und losgelassenen Seelen, der Schönheit und Freiheit, der Gnade
und Harmonie.
Komm, Jessika!
Der Unterschied ist nur der, daß all dieses Elisabethische, Nationale,
Antikatholische in der ersten Fassung, die noch durchaus
chronikalischen Charakter hat, den wesentlichen Sinn des Stückes
bildet und überall Erinnerungen an den glorreichen Sieg über die
Spanier, den Untergang der Armada mit sich trägt; daß es dagegen
in der klassischen Gestaltung einem höheren Sinn untergeordnet ist.
Ich will es nicht behaupten, aber es wäre möglich, daß Shakespeare,
als er diesem Stück die Vollendung schuf, im Sinne trug, daß es zu
dem großen Zyklus der englischen Historien, der ihm
zusammengewachsen war, den Prolog bildete. Jedenfalls ist dieser
König Johann nunmehr auch von innen her eine Art Auftakt oder
Vorspiel zu dem großen Zyklus: sein Thema ist dasselbe: was erst
eine kraftvolle nationale Chronik mit schon erstaunlichen Einblicken
ins Innere handelnder Menschen war, ist jetzt bis zur
Schlußwendung ganz auf den einen Gegensatz gestellt: Politik und
Menschlichkeit. Mit Ausnahme der allerletzten Schlußrede hat der
Dichter nunmehr, selbst wenn er große Schönheiten opfern mußte,
alles direkte Aussprechen streng verpönt; der Charakter ist den
Menschen angegossen, und keiner kann heraustreten aus seiner
Rolle; die päpstliche Politik und ihre Verworfenheit ist mit einer
vorher nicht erreichten Schärfe gezeichnet, aber nicht minder scharf
König Johann, König Philipp von Frankreich, der Dauphin Louis, die
Königin-Mutter Eleonore als Träger der Politik. Und ihnen stehen
gegenüber Konstanze und Arthur, in denen auch Politik wäre, wenn
nicht das Unglück in ihnen säße; und so tritt in ihr das zügellos
leidenschaftliche und leidende Weib, in ihm das unschuldige Kind als
Menschlichkeit der Politik gegenüber. Hubert ist der loyal knechtische
Dienstmann, der von der Menschlichkeit überwunden wird; und der
herrliche Bastard der Naturmensch und Naturritter, dessen
Bestimmung es ist, mit Gesellschaft, Mode, Politik in Beziehung zu
treten, in der er doch in seiner Kraftnatur, so viel äußere
Änderungen, Erhöhungen er auch mitmacht, so sehr er auch
Feldherr und Ratgeber der Krone wird, immer er selbst bleibt.
Mit einem Wort zu sagen: in der frühen Fassung ist Shakespeare in
einem Stadium, das wir nur von diesem Stück her an ihm als eine
Durchgangsstufe kennen, im Stadium Schiller nämlich; in der
klassischen erst ist er zu sich, zu Shakespeare gekommen.
Ich gehe gleich mitten hinein und gebe ein Beispiel, das mich
überaus bezeichnend dünkt. In ihrem Feldzug um die englische
Krone und ihre Länder ist es für jeden der streitenden Könige
überaus wichtig, die Stadt Angers zu besetzen. Die Bürger erklären
— in beiden Fassungen —, sie bewahrten die Stadt für ihren
rechtmäßigen König; wer aber recht habe, das müsse sich erst
erweisen. So kommt es zur Schlacht, die jeder der Könige gewonnen
zu haben behauptet und die gerade darum nach dem Bedünken der
Bürger von Angers, unter deren Mauern sie gewütet hat,
unentschieden geblieben ist. Sie weigern sich erneut, einem von
beiden die Tore zu öffnen, und diese steife Hartnäckigkeit der
Bürgersleute bringt den ritterlichen Bastard zu dem köstlichen
Vorschlag, die feindlichen Könige sollten zunächst ihre Macht
vereinigen, um die eigensinnige Stadt gemeinsam zu berennen und
einzunehmen. Diese Gelegenheit, wo überhaupt von einer Einigung
der streitenden Parteien erstmals die Rede ist, ergreift nun — immer
in beiden Fassungen — der Sprecher der Bürger, um einen
überraschenden Vorschlag zur friedlichen Verständigung
anzubringen, der dem ganzen Handel die entscheidende Wendung
gibt: Der Dauphin Louis und König Johanns Nichte, die junge
Prinzessin Blanca von Kastilien, sollen sich heiraten. Das wird dann
akzeptiert, und es kommt — in beiden Fassungen — zunächst zu
einem Bunde zwischen England und Frankreich auf Kosten des
jungen Arthur, um dessen Thronansprüche willen Frankreich
angeblich den Krieg führt. In der ersten Fassung nun werden dem
Bürger, der den Vorschlag macht, innig schöne Worte für den
Frieden gegen den Krieg in den Mund gegeben, Worte der
Bürgerlichkeit gegen das Kriegsmorden:
Weg damit, sagt der neu schaffende Dichter. Wir kennen seine
unnachahmliche zugreifende Art, sofort ins Thema zu führen, aus
andern Stücken; so nun auch hier. Der Gesandte Frankreichs steht
vor dem Thron, und der König fragt ohne weiteres in einem einzigen
Vers:
Nun sag, Chatillon, was will Frankreich uns?
Und dann hebt der Gesandte, der das Ultimatum überbringt, mit
gemessenen Worten an, und im dritten Vers fällt schneidend das
Wort von der erborgten Majestät des Manns, der da auf dem Thron
sitzt. Statt dessen fiel die erste Fassung hier aus der rhythmischen
Sprache in eine bureaukratische Prosa zur Aufzählung der
Forderungen; breit und fast behaglich wird gesagt, der
allerchristlichste König habe Arthur, den Sohn und Erben von
Johanns älterem Bruder, in Schutz und Vormundschaft genommen;
das kommt jetzt straff, wie ein fester Hieb heraus:
und wo er früher ganz England und was dazu gehört, „zum Besten
besagten Arthurs“ verlangte, ruft er jetzt schwungvoll:
Dann fängt im ersten Text Johann mit seiner Antwort zu rechten und
die Hände über dem Kopf zusammenzuschlagen an; da würde er
selber ja gar nichts übrig behalten und dergleichen. Jetzt weiß
Shakespeare, wie ein König spricht, der, mag er sonst sein, wie er
will, als Machthaber, als Herr, als Stolzer sich bei solcher Gelegenheit
zeigt:
Da ist einmal der Mann und dann als ein gemäßes, passendes
Gewand die Sprache, in der er sich ausdrückt; das geschieht
geziemend, und es ist nichts dagegen zu sagen. Wie aber ist Mann
und Sprache, Situation, Herz und Ausdruck zusammengeschmolzen
in dem herrlichen Katarakt, der sich in der endgültigen Form an
dieser Stelle ergießt! Wie haben wir da in dieser einen einzigen Rede
den ganzen Kraftkerl, seine Natur, seinen Geist und die Neuheit
seiner Rolle, in der er sich trotz aller Zwiespältigkeit zwischen Natur
und Politik, die er sehr wohl empfindet, so treuherzig behagt! Wie
sind wir nun jetzt erst aus der gewöhnlichen Welt einer
chronikalischen Dürre emporgehoben in die Wunderwelt, wo die
Romantik aus dem tiefsten Innern, aus der geistgetriebenen
Leidenschaft quillt! Wollten wir bei der Vergleichung dieser beiden
Fassungen etwa an das Wunder denken, das Goethe vollbrachte, als
er die rhythmische Prosa seiner Iphigenie in die ewigen Verse
verwandelte, so hätten wir noch viel zu wenig getan; diese Iphigenie
in all ihrer genialen, wunderschön menschlichen Konzeption müßte
erst im kümmerlichen Stil eines Mannes aus der Aufklärungsgegend,
so zwischen Bodmer und Gottsched, verfaßt gewesen sein, damit die
Vergleichung ein rechtes Bild gäbe; eher dürfen wir der Verwandlung
gedenken, die Kleist, wenn’s zum Tiefsten kam, Molières Amphitryon
angedeihen ließ; nur daß hier das Überwältigende ist, daß
Shakespeare nicht das Werk eines andern, sondern sich selbst so
übergewaltig in die Höhe riß. Jetzt ruft der Bastard:
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
ebookmasss.com