# Monthly Archives: July 2015

## Design an algorithm, draw a corresponding flowchart and then write a program in C to convert a given string to lower case. 10m Jun2008

Design an algorithm, draw a corresponding flowchart and then write a program in C to convert a given string to lower case. 10m Jun2008

Algorithm

Step 1: Input String

Step 2: Initilise Pointer C to initial character of String

Step 3: while(C != NULL)

{

if (*C>=’A’ && *C<=’Z')

{

*C=*C+32

}
Step 4: Print converted Lower case String

Step 5: Stop

FlowChart:

Program Search S:-

#include<stdio.h>
void main()
{
char S[50],*C;
clrscr();
printf(“\nENTER STRING TO CONVERT TO LOWERCASE : “);
scanf(“%s”,&S);
C=S[0];
while(C != NULL)
{
if(*C>=’A’ && *C<=’Z')
*C=*C+32;
C++;
}
printf(“\nCONVERTED LOWERCASE STRING IS :- %s”,S);
getch();
}

 Source code
```#include<stdio.h>
void main()
{
char S[50],*C;
clrscr();
printf("\nENTER STRING TO CONVERT TO LOWERCASE : ");
scanf("%s",&S);
C=S[0];
while(C != NULL)
{
if(*C>='A' && *C<='Z')
*C=*C+32;
C++;
}
printf("\nCONVERTED LOWERCASE STRING IS :- %s",S);
getch();
}```

Screen Shots:

(b) Write an algorithm and program in C to generate fibonacci series. Use recursion. 10m Jun2008

Solved program can be found on this link http://cssimplified.com/c-programming/a-c-program-to-find-the-fibonacci-series-of-numbers-using-recursion

(c) Draw a flowchart and write a program in C to calculate the number of vowels in a given string. 10m Jun2008

Solved program can be found on this link http://cssimplified.com/c-programming/a-c-program-to-count-number-of-vowels-consonants-spaces-in-a-given-string

(d) What do you mean by ‘array of pointers’? Write a program in C to calculate the difference of the corresponding elements of two arrays of integers of same size. 10m Jun2008

Array of pointers

The way there can be an array of integers, or an array of float numbers, similarly, there can be array of pointers too. Since a pointer contains an address, an array of pointers would be a collection of addresses. For example, a multidimensional array can be expressed in terms of an array of pointers rather than a pointer to a group of contiguous arrays.

4 5 6

7 8 9

Two-dimensional array can be defined as a one-dimensional array of integer pointers by writing:

int *arr[3];

rather than the conventional array definition,

int arr[3][5];

## A computer has 32 words RAM with a word size of 16 bits and a cache memory of 4 Blocks with block size of 16 bits. 10m Dec2007

Assume a computer has 32 words RAM each having a word of 16 bits and a cache memory of 4 blocks, with each block having 16 bits. Where can we find a main memory address 21 in the cache (if it exists) if

(i) Set associative mapping is used?

(ii) Direct mapping is used?

(iii) Associative mapping is used?

Explain your answers with the help of a diagram in each case.     10

Main memory Size = 32 Words

Main Memory word size = 16 bits

Cache Memory Size = 4 Blocks

Cache Memory Block size = 16 bits

⇒1 Block of Cache = 1 Words of RAM

⇒ Total number of possible Blocks in Main Memory = 32/4 = 8 blocks

Associative Mapping:

The block can be anywhere in the cache.

Direct Mapping:

Size of Cache = 4 blocks

Location of Block 21 in Cache = 21 modulo 8 = 5

2 Way set associative mapping:

Number of blocks in a set = 2

Number of sets = Size of Cache in blocks / Number of blocks in a set

= 4 / 2 = 2

Block  21 will be located anywhere in (21 modulo 2) set, that is set 1.

(b) Construct a 4-bit right-shift register with serial input-output using D flip-flops. Describe its functioning. 5

Refer :- MCS-012 Block 1 page 77 and 78

(c) What is a micro-instruction? Explain the three micro-instruction formats, with the help of suitable diagrams.      10

Refer :- MCS-012 Block 1 page 77 and 78

(a) Explain the process of handling an interrupt that occurs during the execution of a program, with the help of an example.            9

(b) Write a program in 8086 assembly language that checks an input string against a password string stored in the memory and outputs an appropriate message if the strings are not equal. 7

(c) What is the significance of FAT? What are thelimitations of FAT 16?    4

Solved program can be found on this link http://cssimplified.com/computer-organisation-and-assembly-language-programming/what-is-the-significance-of-fat-what-are-the-limitations-of-fat-164m-jun2006

(a) What is the sequence of micro-operations required to fetch an instruction? 5

(b) Explain any five addressing modes used in an 8086 microprocessor, with the help of an example of each.      5

## Find the average access time for the disk. 4m Dec2007

Seek time on a hard disk is 50 ms. it rotates at a speed of 3000 rotations/sec. Each track on the disk has 100 sectors. Find the average access time for the disk. 4m Dec2007

Disk Rotation Speed = 3000 rps.  (i.e. 180000 rpm)

Sectors per Track = 100 sectors

Seek time = 50 millisecond

Convertion is Shown Below:

Rotational latency = Average seek time + Average Rotational delay + Controller Overheads

Average seek time = 50 millisecond (given)

Calculate

Average Rotational delay = ½ Time of Rotation in milliseconds

Average Rotational delay = ½ * (60/180000) *1000 millisecond

= ½ * 1/3 millisecond

= 1/6 millisecond

= 0.166 millisecond

Note:-  Controller Overheads (optional) not using it For Now.

Rotational latency = Average seek time + Average Rotational delay

Rotational latency = 50 millisecond + 0.166 millisecond

= 50 + 0.166 millisecond

= 50.166 millisecond.

(d) Explain, with an example of each call, any five DOS function calls supported by INT 21H in the 8086 assembly language.             10

(e) Explain, with an example, the following logic-microoperations:                       6

1.      Selective complement
3.      Insert
4.      Clear

(f) What is the need of master slave flip-flop? Explain its functioning with the help of a suitable diagram.  6

Refer :- MCS-012 Block 1 page 93 and 94

(g) Write a program to evaluate the following expression using an accumulator machine: 7

A = B + C * D * E + F