google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.

Wednesday, July 30, 2014

Question and answer




1. Name the components of CPU
Answer:
a) ALU    b) PC   c) Accumulator   d) MAR   e) IR    f) ID   g) MDR



2. What is the use of registers in CPU?
Answer:
It is used to store intermediate data and instructions.



3. What is the function of MAR?
Answer:
It specifies the address of memory location from which data or instruction is to be accessed or to which the data is to be stored.



4. What is the function of MDR / MBR?
Answer:
It contains the data to be written into or read from memory location addressed by MAR.



5. What is program counter?
Answer:
It keeps track of the memory address of the instruction that is to be executed next.


6. What is the function of IR?
Answer:
It contains the instruction that is being executed.


7. What is the purpose of Instruction Decoder?
Answer:
It decodes the instructions.


8. What is a data bus?
Answer:
It carries a word to or from memory.


9. What is an address bus?
Answer:
It carries memory address. The width of address bus equals the number of bits in the MAR.


10. What is the function of control bus?
Answer:
It carries signals between the units of the computer.


11. Name different I/O ports.
Answer:
Port is a socket on the back of computer. Different types of ports are serial ports, parallel ports and USB ports.


12. What is meant by plug and play cards?
Answer:
It enables the user to add devices to computer.


13. Expand SD RAM.
Answer:
Synchronous Dynamic Random Access Memory.


14. Expand DDR RAM.
Answer:
Double Data Rate Random Access Memory.


15. Write a note on components of motherboard.
Answer:
1) Bus : -
a. Address Bus
b. Data Bus
c. Control Bus
2) Expansion slots: They serve the purpose of adding functionality to the computer.
a. ISA : Industrial standard architecture.
b. PCI : Peripheral component interface
c. AGP : Accelerated Graphic port.
3) CACHE Memory: It is a small fast memory that resides between CPU and main memory.
4) CMOS : Complementary Metal Oxide Semiconductor Battery
5) I-O Ports ( Input –Output Ports ): Serial , Parallel , USB etc.


16. Explain the different factors affecting the processing speed of CPU.
Answer:-
CPU Speed/Clock speed: Speed of CPU also known as clock speed. The clock speed is the
number of instructions executed by the CPU in one second It is measured in megahertz(million
instructions per second). The average speed of a new CPU is about 1000MHz to 4000 MHz.(1 to 4 gigahertz).
Instruction set: The number of instructions decide the efficiency of a CPU. More the instructions, less efficient is the CPU and less the instructions, More efficient is the CPU.
Word size/Register size: The size of registers determines the amount of data the computer can work with at a time. Normally it is 32 bits. Smaller the size of register, slower will be the computer. . It is also known as Word size. It varies from 16 bits to 128 bits.
Data bus capacity: Width of a data bus determines the largest number of bits that can be transported at one time.
Cache Memory size: Cache memory is a high speed memory. Greater the cache, faster a processor runs. Most modern processors can execute multiple instructions per clock cycle which speeds up a program. Some CPU’s have storage for instructions and data built inside the processor chip . This is called internal cache or L1 cache memory.
Memory Size: The amount of PRIMARY STORAGE (RAM) determines the size of program that can be kept in primary storage, which is faster than secondary storage. There by the speed of computer increases. The size of RAM varies from 64 MB to 4 GB.


17. Explain USB Port (Universal Serial Bus).
Answer:
a. It is a high speed serial bus
b. It is a plug and play interface between computers and add on devices.


18. Give the specifications of Laser printer.
Answer:
a. Resolution varies from 600 to 1200 dots per inch.
b. Speed varies from 4 PPM to 24 PPM.
c. Buffer size varies from 4MB to 32 MB
d. Can print color images.


19. Give the specifications of dot matrix printer.
Answer:
a. Print head normally has 9 pins to 24 pins.
b. Speed varies from 30 to 300 characters per second.
c. Buffer size varies from 1K to 64 K.


20. Give the specifications of inkjet printer.
Answer:
a. Resolution is around 300 dots per inch.
b. Speed varies from 1PPM to 12 PPM
c. Buffer size varies from 1 MB to 4 MB.


21. Write a note on computer maintenance.
Answer:
a. Avoid heat dust and noise
b. Periodic updates and enhancements
c. Installing fire walls and anti virus.
d. In house software maintenance
e. Computer periodic checkup.


22. What are the possible threats to a computer system and how to provide security?
Answer:
Threats
a. Privacy
b. Integrity
c. Environmental damage
d. Human threats
e. Software threats
f. Unauthorized access
g. Computer viruses
Security
a. Physical protection of machine and media.
b. Giving passwords and users ID
c. Using Licensed software
d. Use of Cryptography
e. Use of Spike busters and UPS


23. Explain the typical causes of computer failures.
Answer:
a. Break down of components.
b. Excessive dust or humidity
c. Virus
d. Voltage fluctuation
e. Corrosion


24.Write a note on Computer virus.
Answer:
Viruses are collection of coded instructions which are self replicating. When a virus attaches itself to another file it infects it. They are normally inactive until infected program is run.
They are broadly classified into three categories.
a. Boot infectors
b. System infectors
c. Executable program infectors
a.Boot infectors: Create bad sectors. They remain in the memory until the system is shutdown.
b.System infectors: It infects the hard disk or boot-able floppies which may contain system files.
c.Executable program infectors: These are dangerous and devastating. They spread to almost any executable program attaching themselves to programming files.


25. Explain the General Structure of CPU.
Answer:
Program counter: This register stores address of next instruction to be executed.
Memory address register (MAR): This register specifies address in memory where information can be found. This register is also used to point to a memory locations where information can be stored.
Memory buffer register: This register acts as an interface between CPU and memory. When CPU issues a Read Memory command, instruction is fetched and placed in MB register.
Instruction register:This stores a copy of current instruction.
Instruction decoder (ID): ID is an electronic hardware, which decodes instructions. The instructions are further broken down into a set of micro operations, so that they can be executed directly.
General purpose registers: They are used to store data. There are 6 GP registers. These are used for storage of data as needed by the program.
Arithmetic Logic Unit: The basic arithmetic operations such as addition, subtraction, multiplication and division are carried out here. These operations need at least two operands, one which is stored in accumulator and the other in the MBR. After the manipulation of data in ALU, the result is transferred to accumulator.
Accumulator: During processing the intermediate data needed for future processing is stored in
accumulator. The contents of ACC are used by ALU for operations and later by MBR holds the final result for further action.


26. Explain the cache memory in detail.
Answer: 
Cache memory is a small and fast memory between CPU and main memory. It is extremely fast compared to normal memory. Transferring data between main memory and CPU causes delay because RAM is slower than CPU. Cache memory stores copies of data from most frequently used main memory locations. When processor needs to read from or write to a location in main memory, it first checks whether a copy of data is in the cache. If so processor immediately reads or writes to cache. Computers use multilevel of cache such as Level1(smallest)and Level2 cache.CPU resident cache is known as L1 or primary cache (16 to 32 KB) to 512 KB.Cache is also added to mother board also known as L2 cache (512 KB to 1024 KB). Higher end systems can have as much as 2 MB of L2 cache on mother board.



Monday, July 28, 2014

Functions based Qs and answer in C programming

1. What is a function?
Answer:-
A function is a small segment of the program(sub program) designed to perform a specific task and return a result to the main or calling program.


2. What are the different types of functions supported in “C” language?
Answer:-
C supports two types of functions. They are
1. Built-in / Library functions
2. User defined functions



3. What are library functions?
Answer:-
Some of the operations are programmed and stored in C library so that they can be called in the program. These functions are called as library functions.
Eg : printf(), sqrt(), pow()


4. What is a user defined function?
Answer:-
A user-defined function is a complete and independent program unit, which can be used(or invoked) by the main program or by other sub-programs.



5. Mention the need for a function
Answer:-
If there are a number of statements that are repeatedly needed in the same program at different locations,then a function may be used.




6. What do you mean by a calling function?
Answer:-
Once the function is created it can be called from the main program or from any other function. This main program or the function which calls another function is called calling function.




7. What is a called function?
Answer:-
The user-defined function which is called by the main program or from any other function is known as called function.




8. What does the return-type-specifier of a function identify?
Answer:-
It identifies the type of value, which will be sent back after the function has performed its task (eg: int, float).




9. Why is the return type void used?
Answer:-
The return type void is used if the function does not return any value to the calling function.




10. What is an argument?
Answer:-
Information or values are passed to the function through special identifiers are called arguments.




11. What are actual parameters?
Answer:-
The arguments (values) which are passed to the function when a function call is made are called actual parameters.



12. What are formal parameters?
Answer:-
The arguments which are used in the argument list of the function header to receive the values from the calling program are called formal parameters or dummy parameters.




13. Give the syntax of a function call?
Answer:-
A function call has the following syntax:
variable = function_name(arg1,arg2…);
where arg1, arg2… are the actual parameters.




14. How is a function invoked?
Answer:-
A function is invoked(or called) through an output statement or through an assignment statement by using the function name followed by the list of arguments.Example: p = prod(x, y);



15. What is the use of the return statement?
Answer:-
The return statement is used in the body of the function which contains the value that has to be sent back to the main program.




16. Give the syntax of return statement?
Answer:-
The return statement can take one of the following forms return; Or return(expression);The first form does not return any value, where the second function returns the value of the expression.




17. What are local variables?
Answer:-
Variables declared inside a block or function are said to belong only to that block and these are called as local variables. Values of these variables are valid only in that block.




18. What are global variables?
Answer:-
Variables declared before the main function block are called global variables. Values of these variables are available in every block of that program.




19. What is function prototype?
Answer:-
A function must be declared before it is actually called. The declaration of a function is known as function prototype.




20. Give the syntax of a function prototype.
Answer:-
return-type function-name (type1, type2);
Ex: float power(float, int);




21. Define the term recursion.
Answer:-
A function which calls itself directly or indirectly again and again until a condition is satisfied is called as recursive function. This process is called recursion.




22. How do we pass an entire array to a function?
Answer:-
To pass an entire array to a called function only the array name without a subscript is used as argument(actual parameter).
Ex: void main( )
{
int a[100], n;
. . . . . . . . . .
sort(a, n); (where sort is the function name)
}




23 What is meant by scope of a variable?
Answer:-
1. The name of the variable.
2. The amount of space required to store that variable.
3. Address of the memory location.
4. The possible operations, which can be performed with the variable.




24. What are storage classes?
Answer:-
A storage class refers to the scope and life time of a variable i.e., the portion of program where the variable is valid and how long a variable can retain its value is defined
in the storage class.




25. What are the different types of storage classes?
Answer:-
1. Automatic storage class
2. External storage class
3. Static storage class
4. Register storage class



26 does Register variable have address?
Answer:-
No. (CPU registers do not have addresses).




27. Give the differences between library functions and user-defined functions.

Answer:-
Library functions :-
i. Some of the operations are programmed and stored in C library so that they can be called in the program. These functions are called as library functions.
ii. Library functions are in-built functions.

User-defined functions :-
i. Large programs can be broken down into smaller sub programs or modules. These sub programs are called user-defined functions.
ii. User-defined functions are created by the user.




28. What is a function call? What is the syntax of a function call?
Answer:-
To execute a function we will have to call the function. A function call establishes a link between the called function and the calling program.
A function call has the following syntax:
variable = Function_name (arg1, arg2…);
where arg1, arg2… are the actual parameters.




29. Why is the return statement is required in a function body?
Answer:-
When a function is called control is transferred from the calling function (main program) to the called function (sub-program). The statements of the called function are executed and finally the called function is terminated and sends the required result back to the calling function. The return statement is used to send the result from the function to the main program, thus terminating the called function.
The syntax is: return;
Or
return(expression);
The first form does not return any value, where the second function returns the value of the expression.




30. What is a function prototype? When is a function prototype necessary?
Answer:-
The declaration of a function before it is used is called as function prototype. A function prototype contains the data type of arguments sent as input to the function and data type of the result sent back from the function
Syntax: data_type function_name(data_type1,data_type2,….);
Example: float power(float, int);




31. Explain user defined function with an example
Answer:-
User defined function is a subprogram that is called by a main() function or any other function.
A user defined function may appear before or after the main() function. The general syntax of function definition is as follows:
Return_type_ specifier Function_name (type arg1, type arg2….)
{
local variable declarations; argument list
statement1;
statement2;
… Body of the function
statement n;
return (expression);
}
Return data type- indicates the data type of variable sent back from called
function to calling function
Function name- indicates the name of the function .It is an identifier
Argument list- list of input variables and their data-types received from calling
function
Local variable declaration-list of data that required only for the function block in which they are declared.
Body of the function-It includes declaration part (local variables) and a set
of executable statements which will perform the required task.
Return statement- indicates termination of function and transfer of control from called
function to calling function
Example:
int sum(int a,int b)
{
int c;
c=a+b;
return(c);
}




32. Mention different types of functions.
Answer:-
The different types of functions are
1. functions with no input and no return value
2. functions with input and no return value
3. Functions with input and return value
4. Recursive functions




33. What are storage classes? Mention different types of storage classes. Explain
Answer:-
A storage class refers to the scope of data in a program. Scope of data means the portion of the program in which the variable is valid(mian() as well as sub
programs) and lifetime of the variable.i.e., the length of time to which the variable
retains its value.

A variable must belong to any one of the following storage classes.
1. Automatic storage class
2. External storage class
3. Register storage class
4. Static storage class

Automatic storage class :-
Automatic storage class is similar to local variable declaration
Key word auto precedes the declaration
Ex:
auto int x,y,z;
• Automatic variables are local variables
• The variables are stored in memory(RAM)
• The key word auto is implicit(it means even without the word auto the
variable is automatic)
• Initial value stored is junk

External storage class :-
External storage class is similar to global variables.
Keyword extern precedes the declaration
Ex:
Extern int m,n;
• Scope of the variable is global
• The variables are stored in memory
• Needs explicit(must use the keyword)declaration
• Initial value stored is junk

Register storage class :-
Register storage class is used when data is needed in cpu registers
Key word register must precede the declaration
Ex:
register int x,y;
• Scope of the variable is local
• The variables are stored in registers
• Needs explicit declaration
• Initial value is not known

Static storage class:-
Static storage class is used in function blocks. The static variable can be initialized exactly once when the function is called for the first time. For subsequent calls to the same function, the static variable stores the most recent value.
Key word static precedes the variable declaration
Ex: static int x,y,z;
• Scope of the variable is local
• The variables are stored in memory
• Needs explicit declaration
• Default Initial value is stored is 0.


अच्छे विचार करे विचार

  पहचान की नुमाईश, जरा कम करें... जहाँ भी "मैं" लिखा है, उसे "हम" करें... हमारी "इच्छाओं" से ज़्यादा "सुन...