You are on page 1of 43

MODULE 1

Basics of Computer Hardware and Software


Basics of Computer Architecture: processor, Memory, Input& Output devices
Application Software & System software: Compilers, interpreters, High level and low
level languages Introduction to structured approach to programming, Flow chart
Algorithms, Pseudo code (bubble sort, linear search - algorithms and
pseudocode)
Registers
Registers are high-speed storage areas within the CPU, but have the least storage Capacity. Number of registers
and the size of register affect the power and speed of CPU.
•Registers store data, instructions, addresses and intermediate results of processing.
•Registers are often referred to as the CPU’s working memory.
•The data and instructions that require processing must be brought in the registers of CPU before they can be
processed.
•For example, if two numbers are to be added, both numbers are brought in the registers, added and the
result is also placed in a register.
Some of the important registers in CPU are as follows—
•Accumulator (ACC) stores the result of arithmetic and logic operations.
•Instruction Register (IR) contains the current instruction most recently fetched.
•Program Counter (PC) contains the address of next instruction to be processed.
•Memory Address Register (MAR) contains the address of next location in the memory to be accessed.
•Memory Buffer Register (MBR) temporarily stores data from memory or the data to be sent to memory.
•Data Register (DR) stores the operands and any other data.
•The size of register, also called word size, indicates the amount of data with which the computer can work
at any given time.
•The bigger the size, the more quickly it can process data.
•The size of a register may be 8, 16, 32 or 64 bits.
•For example, a 32–bit CPU is one in which each register is 32 bits wide and its
CPU can manipulate 32 bits of data at a time.
•64-bit processor can process the data twice as fast as one with 32-bit processor.
MEMORY UNIT
The memory unit consists of Internal memory(cache memory,primary memory)
and secondary memory.

MEMORY REPRESENTATION
The computer memory stores different kinds of data like input data, output data,
intermediate results, etc., and the instructions. Binary digit or bit is the basic unit
of memory.
A bit is a single binary digit, i.e., 0 or 1.
A bit is the smallest unit of representation of data in a computer. The data is
handled by the computer as a combination of bits.
A group of bytes can be further combined to form a word. A word can be a group
of 2, 4 or 8 bytes.
Memory Hierarchy
The memory is characterized on the basis of two key factors—
•Capacity - the amount of information (in bits) that a memory can store.
•access time - time interval between the read/ write request and the availability of data.
• The lesser the access time, the faster is the speed of memory.
We want the memory with fastest speed(lesser access time) and largest capacity.
MODULE 2
Rules FOR NAMING Identifiers
The rules for naming identifiers are as follows −
•Identifier names are unique.
•Cannot use a keyword as identifiers.
•Identifier has to begin with a letter or underscore (_).
•It should not contain white space.
•Special characters are not allowed.
•Identifiers can consist of only letters, digits, or underscore.
•Only 31 characters are significant.
•They are case sensitive.
Int A=2 Int A=2
B=A++ B=++A
B=2,A=3 B=3,A=3
4. Union:
• Structure and union are same but different in memory allocation.
• A union can be declared using the keyword is union.
• A union is a memory location that is shared by two or more
different variables, generally of different types at different times.
• Defining a union is similar to defining a structure.

STRUCT STUD{
Int rollno;
Float marks;
Char name[5];
}s; s.marks;

union STUD{
Int rollno;
Float marks;
Char name[8];
}s; s.marks;
N=5,
If X=++N we will get
X=6,N=6
If X=N++ we will get
X=5,N=6
Here x=n++,so
x=5,then y=-x=-5.S0
Ans:5,-5

Answer:c
Here, in (c)
a<b,so false valu will
execute,(b>c)?b:c
While checking
b=10,c=8,we will get
b>c,true form will
execute,so answer wll
get b=10C
Ans:C
22>17,so x+y,ie 37

SHORT S[5]-2*5=10

UNION
FLOAT Y-4,LONG-8
UNIN-8 BYTES
Do-while

INT X=4
CONST INT Y=6
Y++
COMPILATION ERROR

114 )answer C
115) Answer B.. Because others are sysytem softwares
116)Answer C..if conditin is true,first statement will
execute,othersise secnd
111)ans:- D
112)ans:-B
113) ANS:-B
114) ANS:-C
115)ans:-B
Here answer is A.
Explanation
Int i=10; //allocates a memory which contains 10
Printf(“%d%d%d",I,++I,I++);
Now, when printf contains multiple arguments then value is assigned from right to
left and printed from left to right.
So, I++=10 //the value of I=10 changes to 11 due to post increment.
Then, ++I=12 //the value of I=11 is pre incremented and changes tplo I=12;
Then, I =12 // now The memory block of I contains 12 only.
So the output should be 121210
#include <stdio.h>
int main(){
int a=10; Outut of this code is
printf("%d",a); 10 10 12
printf("%d",a++);
printf("%d",++a);
return 0;}
117 ans: C
119 ans:C
120 ans A
https://www.examtray.com/c-questions/c-mcq-questions-and-answers-functions-and-pointers-1

https://www.avatto.com/computer-science/test/mcqs/questions-answers/c/7/1.html

You might also like