UNIT-1
1. Define
a Computer?
ANS: A computer is an electronic device capable of manipulating numbers and
symbols under the control of a set of instructions known as computer program.
2.
List out the various components of the computer?
ANS:
1. Arithmetic and Logical unit
2. Memory unit
3. Control unit
4. Input unit
5. Output unit
3.
List out the
various componrnts of CPU?
The CPU (Central Processing Unit) Consists of.
a. ALU (Arithmetic Logic Unit)
b. CU (Control Unit)
c. MU (Memory Unit)
a. The Control Unit Controls all the activities of the
Computer. It sends commands and control signals and finds the sequence of
instruction to be executed.
b. Memory Unit is the place where all input data and
results are stored. Computer memory is also available in the form of Random
Access Memory (RAM)
c. ALU Consists of CKTs for arithmetic
operations(+,-,*,/) and logical operations (<,>,>=,<=,==,!=)
4.
RAM : It is a
temporary storage medium in a computer. The data to be processed by the
computer are transferred from a storage devices or a keyboard to RAM results
from a executed program are also stored in RAM. The data stored will be erased
when the computer is off.
5.
ROM (Read only
Memory) : This is a non-volatile or data storage medium which stores start up
programs (operating systems). This essentially stores the BIOS (Basic Input
Operating System)
6.
Write notes on
programming languages?
Languages of different Generation Computer.
1. First – Generation Language : All the instructions
are in the binary form and are referred to as machine level or low level
language (LLL). It is very difficult to read the instructions written in
binary Eg : 00110101011101110001,
101100001010101
2. Second – Generation Language: all the instruction
are in the forms of mnemonics. The symbolic instruction language called as
Assembly Language. All the symbolic instructions are converted into binaries
with the help of translator called Assembles. Source Program Eg : ADD A, B, R,
3.
Third – Generation Language : These are written in English with symbols and
digits. Then
are known as High level language (HLL). common high level languages are
c,c++,
COBOL, BASIC, FORTRAN, PASCAL, etc.
7.
ASCII
(American Standard Code For Information Interchange) is commonly used for
translation of source Program into object program
8.
Features of “C”
Language :
1. It is robust language because of rich set of binary
in – function
2. It is efficient and fast because of its variant
data-types and powerful operation.
3. It is highly Portable i.e., programs written in one
computer can be run on another
4. It is well suited for structure program, thus
allows the user to think about the problem in the terms of functional blocks.
5. Debugging, testing and maintenance is easy
6. ability to extend itself, we can continuously add
our own functions to the program.
9.
Complier : This
reads the entire source program and converts it to the object code. It provides
error not of one line, but errors of the entire program. It executes as a whole
and it is fast
10. Interpreter : It reads only one line of a source
program at a time and converts it into an object code. In case of errors/same
will be indicated instantly. It executes line by line and it is slow
11. Linker is a function which links up the files that an
present in the operating system, it also links the files for the hardware and
makes the system ready for executing.
12. Preprocessor : This is a program, that processes the
source program before it is passed on to the compiler. The program typed in the
editor is the source code to the preprocessor, then it passed the source code
to the compiler. It is not necessary to write program with preprocessor &
activity Preprocessor directories are always initialized at the beginning of the
program. it begins with the symbol (#) hash. It place before the main()
function
Eg: # include <station> # define PI 3.14
13. Write notes on C character Set?
Character Set : The characters that can be used to
form words and expressions depends upon the computer to which the program is
run
The
Characters in C are
1. Letters A-X, a-z, both upper and lower
2. Digits 0-9
3. Special character, +,-,*,”,;,./,
4. which spaces newline,
horizontal tab;,carriage return ,blank space
14. “C” Tokens: Individual words and punctuation marks are
characters. In a “C” program the smallest individual units are known as “C”
tokens. It has 6types of token‟s.
15. Keywords : Keywords are reserved words by compiler.
Keywords are assigned with fixed meaning and they cannot be used as variable
name. No header file is needed to include the keywords. There are 32 keywords
Eg : auto, break, double, int, float.
16. Identifiers : These are the names of variables
,functions and arrays, these are the user defined names Eg : # define NUM 10 #
define A 20 “NUM”, “A” are user – defined id
17. Constants : constants in “C” are applicable to the
values which not change during the execution of a program.
18. Integer Constants : Sequence of numberr 0-9 without
decimal points, fractional part or any other symbols. It requires two or four
bytes, can be +ve, -ve or Zero the number without a sign is as positive. Eg:
-10, +20, 40
19. Real Constants : Real constants are often known as
floating constants. Eg: 2.5, 5.521, 3.14 etc
20. Character Constants Single character const : A single
character constants are given within a pair of single quote mark. Eg : „a‟, „8‟, etc.
21. String Constant : These are the sequence of character
within double quote marks Eg : “Straight” “India”, “4”
22. Variables : This is a data name used for storing a
data, its value may be changed during the execution. The variables value keep‟s changing during the execution of the program Eg :
height, average, sum, etc.
23. Data types: C language is rich in data types ANSI –
American National Standard Institute ANSI C Supports Three classes of data
types.
1. Primary data type(fundamental)
2. Derived data types
3. User defined data types
24. All “C” compiler supports 5 fundamental data types
1. Integer (int)
2. Character (char)
3. floating point (float)
4. double-precession (double)
5. void
25. 

26. Operator: An operator is a symbol that tells the
Computer to perform certain mathematical or logical manipulations.
27. Expression: An
expression is a sequence of operands and operators that reduces to single value
Eg: 10+25 is an expression whose value is 35
28. Types of Operators?
ANS: C operators can
be classified into a no. of categories. They include:
1. Arithmetic
2. Relational
3. Logical
4. Assignment
5. Increment and Decrement
6. Conditional
7. Bitwise
8. Special
29. Arithmetic Operators: C provides all the basic arithmetic operators, they are +, -, *, /, %
Integer division truncates any fractional part. The modulo division produces
the remainder of an integer division. Eg: a + b a – b a * b -a * b a / b a % b
30. Relational Operator: These are the operators used to Compare arithmetic,
logical and character expressions.the value of a relational express is either
one or zero .it is 1 if one is the specified relation is true and zero if it is
false For eg: 10 < 20 is true 20<10 is false

31. Logical operator : Logical Operators are used when we want to test more than one condition
and make decisions. here the operands can be constants, variables and
expressions Logical operators are &&, ||, ! Eg: a > b && x =
= 10 Logical or compound relational Expression Truth Table && ||, !
32. Assignment Operator: Used to assign the result of an expression to a
variable. „= „is the assignment operator. In addition C has a set of „short
hand‟ assignment operators of
the form
Var Op = Exp
33. Increment and Decrement Operators: ++ and - - The Operator + + adds 1 to the operand
while -- subtracts 1, Both are unary operators Eg : ++x or x ++ == > x+=1 ==
> x=x+1 . -- x or x- - == > x-=1 == > x=x-1
34. A Profix operator first adds 1 to the operand and then
the result is assigned to the variable on left. A postfix operator first
assigns the value to the variable on the left and the increments the operand.
Eg: 1) m = 5; 2). m = 5 y = ++m; y = m++ O/P m =6, y=6 m=6, y=5
35. Conditional operator: is used to check a condition and Select a Value depending on the
Value of the condition. Variable = (condition)? Value 1 : Value 2: If the Value
of the condition is true then Value 1 is e valued assigned to the varable,
otherwise Value2. Eg: big = (a>b)? a:b;
36. Bitwise operator : are used to perform operations at binary level i. e. bitwise. these
operators are used for testing the bits, or Shifting them right or left . These
operators are not applicable to float or double. Following are the Bitwise
operators with their meanings. Operator Meaning & Bitwise AND |
Bitwise OR ^ Bitwise Exclusive – OR << Left Shift >> Right Shift ~
Complement
37. consider a = 13 & b = 6 as 8 bit short int (1byte)
<< Left Shift a = 13 Binary 00001101 b = 6 00000110 Consider a << 2
which Shifts two bits to left , that is 2 zeros are inserted at the right and
two bits at the left are moved out. 00001101 Moved 00110100 Finally the result
is 00110100 . Deci 52 (13x4)
38. WAP to illustrate the use of size of operator main ( )
{ int x = 2; float y = 2; printf (“ in size of ( x ) is %d bytes “, sizeof ( x
)); printf (“ in size of ( y ) is %d bytes “, sizeof ( y )); printf (“ in
Address of x = % u and y = % u “, & x, & y); } o/p sizeof ( x ) = 2
sizeof ( y ) = 4
39. sizeof operator : is used to find the on. of bytes occupied by a variable / data type
in computer memory. eg : sizeof (float) returns 4 int m, x [ 50 ] sizeof (m)
returns 2 sizeof ( x ) returns 100 ( 50 x 2 )
40. comma operator :
can be used to link the related expressions together. A comma- linked: list of
expressions are evaluated left to right and the value of right-most exp is the
value of combined expression.
Eg : value = ( x = 10, y = 5, x = y)
41. Associativity :
when there are more than one operator with same precedence [ priority ] then we
consider associativity , which indicated the order in‟ which the expression has to be evaluated. It may be
either from Left to Right or Right to Left. eg : 5 * 4 + 10 / 2 1 2 = 20 + 5 3
=25
42. Type Casting:
Normally before an operation takes
pace both the operands must have the same type. C converts One or both the
operands to the appropriate date types by “Type conversion”. This can be
achieved in 3 ways.
43. Implicit Type conversion : In this the data type /Variable of lower type (which
holds lower range of values or has lower precision ) is converted to a higher
type (which holds higher range of values or has high precision). This type of
conversion is also called “promotion”
44. Assignment Type Conversion: If the two Operands in an Assignment operation are of
different data types the right side Operand is automatically converted to the
data type of the left side.
45. Explicit Type Conversion: When we want to convent a type forcibly in a way that
is different from automatic type conversion, we need to go for explicit type
conversion. (type name) expression; Type name is one of the standard data type.
Expression may be a constant variable Or an expression this process of
conversion is called as casting a value. Eg: x = (int) 7.5
46. Escape Sequences with their ASC|| values Escape Sequence
Use ASC|| Value \n New line 10 \b
Backspace 8 \f Form feed 12 \‟ Single Quote 39 \\ Back slash 92 \o Null 0 \ t Horizontal tab 9 \ r
Carriage return 13 \ a Alert 7 |? Question marks 63 \“ Double Quote 34
47. a). scanf ( ) function
is used to read values using key board. It is used for runtime assignment of
variables. The general form of scanf( ) is scanf(“format String “ ,
list_of_addresses_of_Variables ); The format string contains - Conversion
specifications that begin with % sign Eg: Scan f(“ %d %f %c”, &a &b,
&c) „&‟ is
called the “address” operator. In scanf( ) the „&‟ operator indicates the memory location of the
variable. So that the Value read would be placed at that location.
48. printf( ): function
is used to Print / display values of variables using monitor: The general form
of printf( ) is printf(“control String “ , list_of_ Variables );
- Characters that are simply printed as they are
- Conversion specifications that begin with a % sign
- Escape sequences that begin with a „\‟ sign.
49. A computer system consists of
hardware and software.
Computer
hardware is the
collection of physical elements that comprise a computer system.
Computer software is a collection of computer programs
and related data that provides the instructions for a computer what to do and
how to do it. Software refers to one or more computer programs and data held in
the storage of the computer for some purposes.
50.
1. Operating System
The Operating
System (OS) is an interface between the compute software and hardware. The most
popular and latest operating systems include Windows XP, Mac, UNIX, Linux,
Windows Vista, etc.
2. Application Software
The
application software is widely used for accomplishment of specific and precise
tasks which is a step ahead than the basic operations or running of the
computer system. The application software includes printing documents, and
permitting access to internet for web and video conferencing activities. The
Application software indirectly does the interaction with the machine to
perform all these functions.
3. System Software
System
software directly interacts with computer hardware. Some of the examples are
the device drivers for CPU, Motherboard, Mouse, Printer, Keyboard, etc. The
system software takes the responsibility of control, integration and managing
individual hardware machine of the computer.
51.
Algorithm:
An algorithm is a description of a
procedure which terminates with a result. Algorithm is a step-by-step method of
solving a problem.
Properties of an Algorithm:
1) Finiteness: - An algorithm
terminates after a finite numbers of steps.
2) Definiteness: - Each step in
algorithm is unambiguous. This means that the action specified by the step
cannot be interpreted (explain the meaning of) in multiple ways & can be
performed without any confusion.
3) Input: - An algorithm accepts zero
or more inputs
4) Output:- An algorithm should
produce at least one output.
5) Effectiveness: - It consists of
basic instructions that are realizable. This means that the instructions can be
performed by using the given inputs in a finite amount of time
52.
Flowchart:
A flowchart is a graphical or
pictorial representation of an algorithm.
Each step in the process is
represented by a different symbol and contains a short description of the
process step. The flow chart symbols are linked together with arrows showing
the process flow direction.
53. 

54.
Program Development Steps:
1. Statement of Problem
a) Working with existing system and
using proper questionnaire, the problem should be explained
clearly.
b) What inputs are available, what
outputs are required and what is needed for creating workable
solution, should be understood
clearly.
2. Analysis
a) The method of solutions to solve
the problem can be identified.
b) We also judge that which method
gives best results among different methods of solution.
3. Design
a) Algorithms and flow charts will be
prepared.
b) Focus on data, architecture, user
interfaces and program components.
4. Implementation
The algorithms and flow charts
developed in the previous steps are converted into actual programs in the high
level languages like C.
55.
General Structure of a C program:
/* Documentation section */
/* Link section */
/* Definition section */
/* Global declaration section */
main() { Declaration part
Executable part (statements) }
/* Sub-program section */
Ø The documentation section is used for
displaying any information about the program like the purpose of the program,
name of the author, date and time written etc, and this section should be
enclosed within comment lines. The statements in the documentation section are
ignored by the compiler.
Ø The link section consists of the
inclusion of header files.
Ø The definition section consists of
macro definitions, defining constants etc,.
Ø Anything declared in the global
declaration section is accessible throughout the program, i.e. accessible to
all the functions in the program.
Ø main()
function is mandatory for any program and it includes two parts, the
declaration part and the executable part.
Ø The
last section, i.e. sub-program section is optional and used when we require
including user defined functions in the program.
56.
Unformatted I/O functions:
1.getchar():Used to read a character
2.putchar():Used to display a
character
3.gets():Used to read a string
4.puts():Used to display a string
which is passed as argument to the function