Monday, August 25, 2014

Basic Programming

Basic Programming 



The way we have different editions of a book ,a programming language also advances by each version.

BASIC also has many versions. John Kemeny and Thomas Kurtz originally developed it at Dartmouth College around the mid -1960 s.It soon became very popular because of its simplicity .Later ,others followed it and developed MS-BASIC, GWBASIC, BASICA and QBASIC.Initally , Microsoft Corporation developed MS-BASIC. Writing programs and getting results was a slow process  and to overcome this limitation ,Microsoft developed its faster version QBASIC .Full form of QBASIC is Quick Beginners All Purpose Symbolic Instruction Code.

It is simple and easily available.

QBASIC has an inbuilt editor .Editor helps in creating ,editing and storing text program files.We can create ,execute and debug a program without leaving QBASIC which speeds up our work.

How to start QBASIC :

It can be started as stated below :

1.By double clicking QBASIC icon on the desktop ,if it exists on the desktop .
2.Clicking on Start  -->Run and typing qbasic.exe along with its full path in the open text box thereafter confirming it by clicking on O.K.
Whichever way we start ,the welcome dialog box gets displayed first and which can be cleared by pressing the Esc key .Thereafter ,we can continue programming.

Rules of BASIC language :

1. Ther should be one statement per line .
2. If a statement does not fit in one line, we can continue it in the next line by inserting semicolon (;) at the end of the first line .
3. A statement should be completed in maximum two lines.
4. Each statement should be numbered .Normally we give number at the interval of 10 .First of all ,it is easy to write and secondly ,if need  arises ,we can insert a statement without changing the other line numbers.

Components of the BASIC language :

Our language comprises of sentences. A sentence is nothing but a combination of words ,and while combining these words ,we follow some rules and norms which we call grammar .Similarly ,any programming language has sentences like statements . These statements comprise of commands and expressions .We can combine commands and expressions to create a set of instructions (program ) which solves a particular program .Each programming language has its own rule for writing statements .Each statement should be written with proper order of command and expression ,which is termed as syntax .Each command has its own syntax.

Some BASIC commands:

1. REM
Syntax  :  <Line no>REM<text message>
Using the REM command ,we can write comments wherever required.

2. LET
Syntax  :  <Line no >LET<text message>
example:
LET A=20
LET SUM=A+B

3. INPUT
Syntax  : <Line no>INPUT<text message>
example:
INPUT "Enter name and age";Name$,AGE

4. PRINT
Syntax  : <Line no >PRINT<print item>separator<print item>......
To print more than 1 item ,we have to use separator like comma or a semicolon.
example :
50 PRINT X,Y,Z
60 PRINT "X=";X,"Y=";Y
70 PRINT
80 PRINT A;B;C

5. READ-DATA
Syntax : <line no>READ<variable 1,variable 2,....>
<line no>DATA<value 1,value 2,....>
example
40 READ name$,age
50 PRINT "Your name is";name$
60 PRINT "Your age is ";age
70 DATA "Vijay",40

6. GO TO
Syntax: <line no>GO TO<line no>
example :150 GO TO 50

7. IF...THEN...ELSE
Syntax: <line no>IF condition >THEN n

8. FOR.....NEXT:
Syntax: <line no> FOR<variable>=formvalue >TO <to value>STEP <value>
<statement to be repeated>


 <statement to be repeated>

<statement to be repeated>


NEXT <variable>

9.LOCATE
Syntax: <line no > LOCATE x,y

10 CLS
Syntax :CLS command clears the screen .Normally it is used to start the program .
Example: 10 CLS

11. END :This command is used to instruct the end of the program
example: 70 END



Program to find area of a circle :

10 CLS
20 REM Program to find Area of Circle.
30 INPUT "Enter Radius";R...
40 LET Area = 3.14 *R^2
50 PRINT "Area of Circle with radius "R;"is";Area
60 END

Program :FOR ...NEXT LOOP

10 CLS
20 REM Repeat Action
30 FOR I=1 TO 5
40 PRINT "I Love My India"
50 NEXT I
60 ENd

RUN  (For this Pres F5)

I Love My India
I Love My India
I Love My India
I Love My India
I Love My India

 Program to print the squares of first 50 odd numbers:

10 REM Program to print the squares of first 50 odd numbers
20 CLS
30 PRINT "Number","Square"
40 PRINT "-----------------"
50 FOR I=1 To 99 STEP 2
60 LET SQ=I^2
70 PRINT I,SQ
80 NEXT I
90 END

Output:

Number      Square
   1                  1
   3                  9
   5                  25
   7                  49
    .                  .
    .                  .
   97                 9409
   99                9801

Program to prepare a table of any number

5  CLS
10 REM Program to prepare table of any number
20 INPUT "Enter Any Number -",N
30 LET X=1
40 S=N*X
50 PRINT N;"X";X;"=";S
60 X=X+1
70 IF X<11 THEN GO TO 40 ELSE PRINT "OVER"
100 END
RUN ---------------(Press F5 key)
Enter Any Number -----------(Suppose we have entered  17)

We get output:

17x1=17
17x2=34
and so on
17x10=170
OVER

GRAPHICS IN BASIC

Program to draw a circle

10 CLS
20 REM Program to draw a circle
30 SCREEN 1
40 CIRCLE(70,85),25
50 END





Wednesday, August 13, 2014

MS-Excel



1)Specify any one type of charts available in spreadsheet.
 

Answer: 
Bar graph, Column graph, Pie chart, Line graph, etc.

2)Give any one built-in function of spread sheet.
 

Answer:
 SUM(range) : This function returns the sum of all the numbers
in the list of arguments.
Example: =SUM(A2:E2)



3)What are macros in ESS?
 

Answer:
 Macro is a small program that caries out pre-defined series of steps by giving a few
keyboard shortcuts.
Macro is like a batch file created in dos. It contains a series of commands.
When a macro is called and run, the instructions given in it are executed one by one.



4)Differentiate between MAX( ) and MIN( ) built-in functions in a spread sheet.
 

Answer: 
MAX(num 1, num 2,……) : Returns the largest value in a set of values.
Example: =MAX(15, 25, 8, 14) returns 25
MIN(num 1,num 2……) : Returns the lowest value in a set of values.
Example: =MIN(15, 25, 8, 14) returns 8



5)Explain briefly built in functions in spreadsheet.
 

Answer:
SUM(range) : this function returns the sum of all the numbers
in the list of arguments.
Example: =SUM(A2:E2)
ABS(number) : It returns absolute value of a number.
Example: =ABS(-35)=35
SQRT(number) : This function returns a positive square root.
Example: =SQRT(5) equals 2.1928.
AVERAGE(num 1, num 2……) : Returns the average of the set of numbers.
Example: =AVERAGE(15, 25, 50) returns 30.




6)Explain Arithmetic functions of MS-Excel.
 

Answer:
SUM(range) : this function returns the sum of all the numbers
in the list of arguments.
Example: =SUM(A2:E2)
ABS(number) : It returns absolute value of a number.
Example: =ABS(-35)=35
SQRT(number) : This function returns a positive square root.
Example: =SQRT(5) equals 2.1928.
PRODUCT(num1, num2…) : It returns the product of all the
numbers given as arguments.
Example: =PRODUCT(5,8,2)=80





7)Explain DATE functions used in spreadsheets.
 

Answer: 
DAY(serial number) : It returns the day of the days corresponding to serial number or
date.
Example: DAY (“5-jan”)=5
MONTH(serial number) : It returns the month corresponding to serial number or date.
Example: MONTH(“6-may”)=5
NOW( ) : This function returns the serial number of the current date and time.
DATE(year, month, day) : Returns the serial number of a particular date.
Example: DATE: (2005,3,23) returns 38434.




8)Briefly explain advantages of spreadsheet.
 

Answer:
i. Built-in Functions: It has rich set of built-in functions to perform all types of
calculations such as sum, max, abs, product, etc.,
ii. Copying formula: Similar formula can be copied into any number of cells.
iii. Fill series: It is used to fill automatically fill numbers or data in a series of cells.
iv. Sorting: The data can be arranged in a specific order in a table.



9)Explain Logical functions in Ms-Excel.

Answer:
1. AND(logical1, logical2………) : This function returns TRUE if all its
arguments are true, returns FALSE if one or more arguments are FALSE.
Example: =AND(3<5, 8=8) returns TRUE
=AND(3>5, 8=8) returns FALSE
2. OR(logical, logical 2………) : It returns TRUE if one or more arguments are
TRUE, returns FALSE if all its arguments are FALSE.
Example: =OR(3<5, 8<>8) returns TRUE
=OR(3>5, 8<>8) returns FALSE
3. NOT(logical) : Reverses the value of its arguments.
Example: =NOT(3<5) returns FALSE
=NOT(3>5) returns TRUE
4. If(logical-test, value1, value2) : It returns value1 if logical test is true. If logical test is
false it returns value2.
Example: =If(85>80, “Dist”, “I Class”) returns “Dist”
=If(40>50, 100, 200) returns 200





Sunday, August 3, 2014

MOTHERBOARD

What is motherboard ? 
Or
Short Note on motherboard.

Answer:-

1)Motherboard specifically refers to a printed circuit board(PCB) with expansion capability and as the name suggests, this board is the "mother" of all components attached to it, which often include sound cards, video cards, network cards, hard drives, or other forms of persistent storage; TV tuner cards, cards providing extra USB or FireWire slots and a variety of other custom components .

2)It is the main circuit board in a computer.

3)A motherboard provides a way for hardware in a computer to communicate with each other.

4)The term mainboard is applied to devices with a single board and no additional expansions or capability, such as controlling boards in televisions, washing machines and other embedded systems.

5)An important component of a motherboard is the microprocessor's supporting chipset, which provides the supporting interfaces between the CPU and the various buses and external components. This chipset determines, to an extent, the features and capabilities of the motherboard.

6)It holds many of the crucial electronic components of the system, such as the central processing unit (CPU) and memory, and provides connectors for other peripherals.

7)Motherboards contain some non-volatile memory to initialize the system and load some start up software, usually an operating system, from some external peripheral device.






                                                           Figure :- Motherboard

Saturday, August 2, 2014

Solve sums of arithmetic



1. Find the smallest number which when diminished by 3,is exactly divisible by 21,28,36 and 45.

  Answer:-   1263  


2.If we multiply a fraction by itself and divide the product by its reciprocal , we get 1826/27. Find the original fraction.

Answer :-   2  2   
                       3



3. By what least number must 21,600 be multiplied to make it a perfect cube?

Answer :-  10


4.Solve
  0.5 * 0.05 * 0.005 * 50

Answer:-  0.006250


5. The value of a machine depreciates at the rate 10% every year. It was purchased 3 years ago.If its present value is Rs 8,748 , find its purchase price.

Answer :-  Rs 12,000



6. On a journey across Delhi , a taxi averages 30 kmph for 60% of the distance,20kmph for 20% of it and 10 kmph for the remainder. Find the average speed for the whole journey.

Answer:-  20 km per hr


7. A mixture contains alcohol and water in the ratio of 4:3 .If  7 litres of water is added to the mixture, the ratio of alcohol and water becomes 3:4 . Find the quantity of alcohol in the mixture.

Answer:-  12 litres


8. A and B can do a piece of work in 12 days, B and C in 15 days,C and A in 20 days.In how many days A alone will do the work?

Answer:-  30 days


9. At a certain rate of simple interest, a certain sum doubles itself on 10 years,it will treble itself?

Answer:-  20 years



10. If the ratio of the areas of two squares is 9:1 ,then what will be the ratio of their parameters?

Answer:-  3:1


11. If a commission of 10% is given on the written price of an article ,the gain is 20 % .Find the gain percent if the commission is increased to 20 %.

Answer:-  6  2 %
                     3



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.


Array based Qs and answers

1) What is an array?

Answer:-
An array is a group of data of the same data type stored in successive storage locations.



2)How are elements of an array accessed?

Answer:-
Elements of an array are accessed using subscripts.



3)What is a subscript?

Answer:-
A subscript or an index is a positive integer value that identifies the storage position of
an element in the array.



4)Which is the smallest subscript?

Answer:-
0 (zero)



5)How many subscripts does a one and two dimensional array have?

Answer:-
one dimensional array has one subscript and a two dimensional array has two
subscripts( row and a column subscript).



6)Write the syntax for declaring a one dimensional array.

Answer:-
syntax: datatype arrayname [size];



7) Write the syntax for declaring a two dimensional array.

Answer:-
Syntax: datatype arrayname [row size] [column size];



8) What do you mean by initializing an array?

Answer:-
Initializing of an array means storing data in to an array at the design time.



9) How one dimensional array is initialized?

Answer:-
The initialization can be done two ways –
• Initialization at design level- in this method of initialization the data values are
stored in to the array at the time of array declaration. 
Example: 
int a [0]={10,-50,20,300,5};
• Initialization at run time- to initialize an array at run time means to input data values
in to the array at the time of execution of the program.
Example:
int a[10];
for (i=0;i<10;i++)
scanf(“%d”,&a[i]);



10) How to output the elements of one dimensional array?

Answer:-
To print elements of an array a for loop is used.
Example:
int a[10];
for(i=0;i<10;i++)
printf(“%d\n”,a[i]);



11) How two dimensional arrays are initialized?

Answer:-
• initialization at design time- the data element are stored in to the array at the time
of declaration of the array. The elements of each row and each column are
represented within the pair of flower brackets.
Example : int a[3][3]={1,3,5,3,7,82,5,8};
• initialization of the array at the time of execution- to input data in to two
dimensional array, two for loops are used foe every value of the outer loop index.
The inner loop is executed a specified number of times.
Example: int a[4][5];
for(i=0;i<4;i++)
for(j=0;j<5;j++)
scanf(“%d”,&a[i][j]);



12) How do you print a matrix? Give ex.

Answer:-
A two dimensional array can be printed as follows-
int a[3][4];
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
printf(“%d\t”,a[i][j]);
}
printf(“\n”);
}





Unix based Qs and ans


1. What are the events done by the Kernel after a process is being swapped out from the main memory?

Answer :-
1.Kernel decrements the Reference Count of each region of the process. If the reference count becomes zero, swaps the region out of the main memory,
2.Kernel allocates the space for the swapping process in the swap device,
3.Kernel locks the other swapping process while the current swapping operation is going on,
4.The Kernel saves the swap address of the region in the region table.



2.Is the Process before and after the swap are the same? Give reason.

Answer :-
1.Process before swapping is residing in the primary memory in its original form. The regions (text, data and stack) may not be occupied fully by the process, there may be few empty slots in any of the regions and while swapping Kernel do not bother about the empty slots while swapping the process out.
2.After swapping the process resides in the swap (secondary memory) device. The regions swapped out will be present but only the occupied region slots but not the empty slots that were present before assigning.
3.While swapping the process once again into the main memory, the Kernel referring to the Process Memory Map, it assigns the main memory accordingly taking care of the empty slots in the regions.




3.What is Fork swap?

Answer :-
"fork()" is a system call to create a child process. When the parent process calls "fork()" system call, the child process is created and if there is short of memory then the child process is sent to the read-to-run state in the swap device, and return to the user state without swapping the parent process. When the memory will be available the child process will be swapped into the main memory.




4.What are the entities that are swapped out of the main memory while swapping the process out of the main memory?

Answer :-
1.All memory space occupied by the process, process's u-area, and Kernel stack are swapped out, theoretically.
2.Practically, if the process's u-area contains the Address Translation Tables for the process then Kernel implementations do not swap the u-area.




5.What is Expansion swap?

Answer :-
At the time when any process requires more memory than it is currently allocated, the Kernel performs Expansion swap. To do this Kernel reserves enough space in the swap device. Then the address translation mapping is adjusted for the new virtual address space but the physical memory is not allocated. At last Kernel swaps the process into the assigned space in the swap device. Later when the Kernel swaps the process into the main memory this assigns memory according to the new address translation mapping.




Friday, July 25, 2014

Install Windows

To install Windows XP operating system follow steps :-

Minimum System Requirements:-
  • 300 MHz Intel or AMD CPU
  • 128 megabytes (MB) of system RAM
  • 1.5 gigabytes (GB) of available drive space
  • Super VGA (800x600) or higher display adapter
  • CD or DVD-ROM
  • Keyboard and mouse, or other pointing devices
  • Network Interface Adapter required for Internet and Network Connectivity
Turn your computer on then press Del or F2 to enter the system BIOS
Go to Boot menu and choose Boot From CD/DVD.
Press F10 to save the configuration and exit BIOS then reset your computer.
Insert Windows XP DVD into your DVD drive then start up your computer,

Step 1:-Load the installer.
 Once your Boot Order is set, insert the Windows XP CD into your drive and Save and Exit from the BIOS. Your computer will reboot and you will be presented with the message: Press any key to boot from CD. Press any key on your keyboard to start the Setup program.
Setup will load files necessary to begin the installation, which may take a few moments. Once the loading is complete, you will be taken to the Welcome screen.


Step 2:- Press ENTER to begin installation.
Once the loading is complete, you will be taken to the Welcome screen. You are given several options, but if you are installing or reinstalling Windows XP, you’ll want to press ENTER to start the installation configuration.


Step 3 :-Read the License Agreement.
 This document tells you what you can and can’t do with Windows, and your rights as the consumer. After reading, press F8 indicating you agree to the terms.

Step 4 :- Select the partition you want to install on.
You will see a list of available partitions on your installed hard drives. If you are installing Windows XP on a new hard drive, you should see only one entry labeled "Unpartitioned space." If you have a previous version of Windows or Linux installed on your computer, you will potentially have multiple partitions.
Installing Windows XP will erase all of the data on the partition that you choose. Select a partition that is empty or that contains data that you do not care to lose.
You can delete your partitions with the “D” key. This will return them to “Unpartitioned space”. Any data on the partition will be lost when it is deleted

Step 5 :-Create a new partition.
 Select the Unparititioned space and press “C”. This will open a new screen where you can set the partition’s size from the available space. Enter the size in megabytes (MB) for the new partition and then press ENTER.

Step 6 :-Select your new partition.
 Once you’ve created your installation partition, you will be returned to the partition selection screen. Select your new partition, usually labeled "C: Partition 1 [Raw]" and press ENTER.

Step 7 :- Select "Format the Partition using the NTFS File System" and press ENTER.

Step 8:- Wait for the format and Setup files to copy and for for the installation to proceed.

Step 9:- Choose your language and region settings.Click the Next button when that is completed.Enter your full name if you want. This will be set as the “owner” of Windows, and will be attached to certain things, such as Document creation.

Step 10:- Enter your Product Key. You will not be able to complete the installation process without a valid Product Key. Click "Next" to continue.

Step 11:-Set your computer’s name. This will be the name that represents the computer on a network. Windows sets a default name, but you can change it if you would like. You can also set a password for the Administrator account. This is optional, but recommended for public computers.

Step 12:-Select your time zone. Ensure that the date/time are correct. Click "Next" to continue.

Step 13:- Choose your network settings.

Step 14:- Wait for the installation to finalize.
This will only take a few minutes, and the computer will reboot when it is finished installing. Once the computer reboots, you will be taken to the Windows XP desktop. At this point, installation is complete, though there are a few things left to do before Windows is completely usable.



To install Windows 7 operating system follow these steps:-

Check Hardware requirements:-
  • 1 GHz CPU with 32 bits or 64 bits
  • 1 GB Ram for 32 bits or 2 GB Ram for 64 bits.
  • 16 GB empty space hard disk for 32 bits or 20 GB for 64 bits.
  • DVD drive
Step 1:-Turn your computer on then press Del or F2 (depend on your computer’s mainboard) to enter the system BIOS

Step 2:-Go to Boot menu and choose Boot From CD/DVD.

Step 3:-Press F10 to save the configuration and exit BIOS then reset your computer.

Step 4:- Insert Windows 7 DVD into your DVD drive then start up your computer, Windows 7 will be loading files.

Step 5:- Select these parts: Language to Install,Time and currency format, Keyboard or input method. Then click Next.

Step 6:-Choose Install Now if you want to install Windows 7. Choose the Windows 7 version that you want to install in 'Select the operating system you want to install' . Here we choose Windows 7 Ultimate then click next (depending on your Windows DVD, this step is an option).

Step 7 :-Click 'I accept the license terms' in 'Please read the license' then click Next.

Step 8:-Choose 'Upgrade' in 'Which type of installation do you want' if you want to upgrade from an older Windows version to Windows 7, 'Custom (advance)' if you want to install a new version of Windows.

Step 9:- Choose Partition for installation, if your computer has only one hard disk, it will be easy for selection, but if it has some Partition, you will have to consider which Partition to choose.

Step 10:-Wait for Installing Windows to progress. Your computer might be restarted during the process.

Step 11:- Type you’re a user account and computer name. After click Next.

Step 12:-Type a password for your account, you can also Type a password hint to help in case of forgetting the password in the future, and then click Next.

Step 13:-Type in activation code or key for your license in Product key box if you have any. Click Next.

Step 14 :-Choose how to protect your Windows. Here we choose Use recommended settings.

Step 15 :-Set up your Time zone then click Next.

Step 16:- Choose an option from 3 choices: Public Network, Work Network, Home Network. Choose Home Network for using Internet at home.

Solve Computer Science Questions

Solve Computer Science Questions




1. With four programs in memory and with 80% average I/O wait , the CPU utilization is?

A) 60 %
B) 70 %
C) 90 %
D) 100 %




2. To employ multi - access in GSM , users are given different:


A) time slots
B) bandpass filters
C) handsets
D) frequency bands




3.What will be the value of 'b' after the execution of the following code statements:
c = 10;
b = ++c + ++c;


A) 20
B) 22
C) 23
D) None




4. What of the following does not represent a valid storage class in 'c'?

A) automatic
B) static
C) union
D) extern




5. Find the odd man out :

A) tail
B) cut
C) wart
D) sed




6. We can not delete the ____icon but we can made it invisible.

A) Recycle
B) My computer
C) Internet explorer
D) None of the above




7. The device which connects dissimilar LAN's of different topologies using different sets of communication protocols so that information can flow from one to another is called:

A) Router
B) Bridge
C) Gateway
D) Switch




8. Capability Maturity Model is meant for;

A) Product
B) Process
C) Product and Process
D) None of the above




9. In the light of software engineering software consists of:


A) Programs
B) Data
C) Documentation
D) All the above




10. Variable partition memory management technique with compaction results in:

A) Reduction of fragmentation
B) Minimal wastage
C) Segment sharing
D) None of the above




Featured posts

Happy Independence Day August 15th

 Here's a message for India's Independence Day (August 15th): "शुभ स्वतंत्रता दिवस! आजादी की 79वीं वर्षगांठ पर, आइए हम अपने देश...

Popular posts