Search This Blog

Wednesday, January 27, 2010

microprocessor qbank

MICROPROCESSORS AND MICROCONTROLLERS

PART A

SUBJECT CODE: CS2252

COMPUTER SCIENCE ENGINEERING IV SEMESTER/II YEAR

1) Define microporcessor

2) Define assembly language

3) Define machine language

4) Draw a microprocessor based system with bus architechture

5) Define system bus

6) Define operating system

7) Classify the signals of 8085

8) Define instruction cycle, machine cycle, T-state

9) Draw the logic diagram to generate control signals in 8085

10) List the flags in 8085

11) Define program counter

12) Define stack pointer

13) List the addressing modes of 8085

14) Classify the instructions in 8085

15) Define 1-byte, 2-byte and 3-byte instructions.

PART B

1) Draw the pin diagram of 8085 and explain the signals of 8085

2) Explain briefly the architecture of 8085

3) Explain the addressing modes of 8085

4) Explain the instruction set of 8085

5) Illustrate the steps and the timing diagram of dataflow for opcode fetch, memory read, momory write, I/O read, I/O write and interrupt acknowledge.

4:12 PM | Add a comment | Permalink | Blog it | Academic

Saturday, January 23, 2010

algorithm answers

1. Algorithm for nth number in Fibonacci series

Read n

f1 <- -1

f2 <-1

i <- 0

while i<=n

f3 <- f1+f2

f1 <- f2

f2 <- f3

i <-i + 1

End while

Display f3


3. Recursive function to find the factorial

FUNCTION FACTORIAL (N: INTEGER): INTEGER



BEGIN

(* TEST FOR STOPPING STATE *)

IF N <= 0 THEN

FACTORIAL := 1

ELSE

FACTORIAL := N * FACTORIAL(N - 1)

END


4. If lim f(n)/ g(n) = 0 then f(n) = O(g(n))

n->∞ = ∞ then f(n) = ω(g(n))

= constant then f(n) = θ(g(n))

Here

Lim n+n logn/ n.n^(1/2) if we apply L hoptial’s rule we get 0, therefore

n->∞

n+n log n = O (n.n^(1/2))

In this way computing the limit helps us in comparing the order of growth of 2 specific function.


5. Algorithm to find the number of binary digits

Recursive procedure:

Function F(X: integer)

{

If X= =0 or X= = 1 Then

Return 1;

Else

Return 1+ F(X/2);

}

End Function

Analysis:

T(n) = 1 + T(n/2)
solving we get T(n)=0(nlogn)

6. Linear search – In class notes


7. Algortihm for multiplication of two matrices

MATRIX-MULTIPLY(A, B)

1 n ← rows[A]

2 let C be an n × n matrix

3 for i ← 1 to n

4 do for j ← 1 to n

5 do ci j ← 0

6 for k ← 1 to n

7 do ci j ← ci j + aik · bkj

8 return C


8. substituting n = 2k we get the roots as 2,2,1 and the time complexity as O(n log n)



9. There are two possible solutions, ω(n2 ) or O(n3).


10. 1. Algorithm computes sum of squares of 1 to n numbers.

2. Basic operation(inside for loop)
3. basic operation executed n times.
4. Efficiency class – O(n)

source: viveks blog

Thursday, January 21, 2010

daa imp questions

(1) Write an algorithm for a given number n to generate the n’th number of the Fibonacci sequence.
-----May/June 2007

(2) (A) What is pseudo code? Explain with an example [ 8 marks ]
(B) Find the complexity C(n) of the algorithm for the worst, best and average case
{ evaluate average case complexity for n=3, where n is the number of inputs } [ 8 marks ]

(3) Write a recursive function to find the factorial of a number n ---> 2 mark
April/May 2008

(4) How does computing the limit help in comparing the order of growth of 2 specific function?
Compare the orders of growth of n+nlogn and n.n^(1/2)
April/May 2008

(5) Write an algorithm to find the number of binary digits in n's binary representation and analyse the same
---> 8 mark

(6) write an algorithm to search linearly for an element X in an ordered list of ‘n’ entries. What is the best , worst, average case analysis and justify your answer?
(7) Write an algorithm that finds the product of 2 matrices
-->2marks Nov/Dec 2004
(8) Solve the following recursive relation
Q(n) = n-1 + 2Q(n/2) and given Q(1) =0. Assume that Q is defined for all powers of 2

(9) Find the order of n^2 + logn
-->2marks April/May 2005
(10) Consider the following algorithm
Mystery(n)
//Input: A non-negative integer n
S<-0
For i<-1 to n do
s<- s + i*i
return s
a) What does this algorithm compute?
b) What is its basic operation?
c) How many times is the basic operation executed ?
d) What is the efficiency class of this algorithm ?
e) Suggest improvements for this algorithm and justify your improvement by analysing its efficiency
May/June2009

os fifth exp

LS Command

#include "stdio.h"

#include "sys/types.h"

#include "dirent.h"

main(int age, char *argv[])

{

DIR *dir;

struct dirent *rddir;

printf(“/n Enter directory with outoput command”);

dir=opeindir(argv[1]);

while((rddir=readdir(dir))!=NULL)

{

printf(“%s\t”,rddir->d_name);

}

closedir(dir);

}


GREP command

#include "stdio.h"
#include "stdlib.h"
main()
{
FILE *fp;
char c[100], pat[10];
int l,i,j=0,count=0,len,k,flag=0;
printf("\n Enter the pattern");
scanf("%s", pat);
len=strlen(pat);
fp=fopen("nn.txt","r");
while(!feof(fp))
{
fscanf(fp,"%s",c);
l=strlen(c);
count++;
for(i=0;i
{
if(c[i]==pat[j])
{
flag=0;
for(k=1;k
{
if(c[i+k]!=pat[k])
flag=1;
}
if(flag==0)
printf("\n The pattern %s is present in word %d", pat,count);
}
}
}
}