Tuesday, September 4, 2018

DLD OBJECTIVE QUESTIONS


DIGITAL LOGIC DESIGN

OBJECTIVE QUESTIONS

UNIT-1

1. What is the binary equivalent of the decimal number 368    [   B    ]
A) 110110000    B) 101110000  C) 111100000         D) 111010000                        

2. The code where all successive numbers differ from their preceding number by single bit is                                                                                                             [  D ]                                                           
A) Binary Code       B) BCD     C) Excess-3      D) Gray       

3. -8 is equal to signed binary number                                    [   B    ]
A) 00001000    B) 10001000  C) 10000000     D) 11000000

4. The 9’s Compliment of 546700 is                                      [ B   ]
A. 435299       B. 453299     C. 432599     D. 425399

5. Which of the following are called Universal gates           [     B ]
A) NAND, NOR  B) AND, OR  C) XOR XNOR  D) OR, XOR

6. x+y=y+x is the                                                                [ A     ]
A) commutative property B)inverse property C) associative property D) identity element

7. The decimal equilent of the binary number 101101 is            [    B  ]
            A) 48     B)45     C)57     D)75

8. The number of bits required to represent ASCII code of a Character is --[A]
  A) 7   B) 2  C) 4   D) 6

9. Convert binary 101011110010 to hexadecimal.    [ D ]
A) EE2 (16)  B) FF2 (16)   C) 2FE (16)   D) AF2 (16)

10. Gray Code of the binary number 111001010 is     [A]
A) 100101111    B) 100001001    C) 11110010    D) 100111001

11.When the set of input data to an even parity generator is 0111, the output will be  1
12. Signed 2’s complement representation of decimal number of -17 by using 8 bit representation is          11101111
13.When simplified with Boolean Algebra (x + y)(x + z) simplifies to  x+yz
14.  (x’)’ is  x
15. Not gate is also known as inverter
16.  10's complement of the decimal number 3750 is 6250
17.  In Ex-NOR truth table, output for input combination of 1 and 0 is __________________.
18. In Boolean Algebra A+AB is = A
19. The given expression Y=A+AB+ABC in Canonical form is   ABC+ABC'+AB'C+AB'C'
20.The most common error detecting code used is called parity bit


UNIT-2

1. Karnaugh map is used for the purpose of       [C]
A) Reducing the electronic circuits used.   B) To map the given Boolean logic function.
C) To minimize the terms in a Boolean expression. D) none

2.The canonical form of Boolean Function f(x,y,z) = xy + yz’x is  [C ]
         A) xyz + yz’x’ B) xyz + yz’ C) xyz + xyz’ D) xyz + 2xyz’

3. The output levels which are indicated by ‘X’ or ‘d’ in the truth tables are called 
                                                                                                       [D]
A) Dont care outputs  B) Dont care conditions          C) incompletely specified functions
D) All of the above

4.Boolean functions expressed as a Sum of minterms or Product of maxterrms are said to be in
                                                                                                                [ D]
A. Product terms B. Sum terms C. Standard form D. Canonical form

5.  Combining the maximum possible no of adjacent squares in a map is called 
                                                                                                                [ C ]
    A) Odd implicant B) Even implicant C)Prime implicant D) Integer implicant

6. The code for labelling the cells of the K map is ______        [C]
   A)BCD        B)Hexadecimal code      C)Gray      D)Octal

7.The implementation of a boolean function with NAND-NAND logic requires that the function be
       simplified in ___________________            [B ]
     A)POS     B)SOP     C)both a and b   D)none

8. In K Map  Don't care Conditions marked by ____[C]                                              
    A)1     B)0     C)X     D)all

9. What is group of four adjacent 1's 0r 0's called _      [B]
     A) pair    B)Quad    C)Octet     D)    None of these

10. Any logical expression can be realized by using only____[  D ]
      A)AND gates        B)OR gates        C)NOT gates     D)NAND or NOR gates

11.T  he simplified expression for the function F 1 = f(A,B,C) = (2,3,7) is A'B+BC
simplified in POS
13. Simplify the three variable expression y=∑m(1,3,5,7) gives C
14.SEQUENTIAL CIRCUITS  are the circuits whose output variables at any instant of time are dependent not   only on the present input variables, but also on the previous outputs variables.
15. The Number of NAND gates required to realize EX-OR gate is 4
16. NAND – NAND Realization is equivalent to AND-OR REALIZATION
17. The logic function which is produced by adding an inverter to each input and output of an AND gate is   OR
18. Three variable will be represented by 8 minterms
19. The prime implicant which has at least one element that is not present in any other implicant is known as  Essential Prime Implicant
20.The number of cells in a 5 variable K-map is 32

Tuesday, March 20, 2018

Banker's Algorithm

#include 
struct file  { 
  int all[10]; 
  int max[10]; 
  int need[10]; 
  int flag; 
  }; 
  void main() 
  {
    struct file f[10];
    int fl;
    int i, j, k, p, b, n, r, g, cnt=0, id, newr; 
    int avail[10],seq[10]; 
    printf("Enter number of processes -- "); 
    scanf("%d",&n);
    printf("Enter number of resources -- "); 
    scanf("%d",&r);  for(i=0;i    {
      printf("Enter details for P%d",i);
      printf("\nEnter allocation\t -- \t");
      for(j=0;j      scanf("%d",&f[i].all[j]);
      printf("Enter Max\t\t -- \t"); 
      for(j=0;j      scanf("%d",&f[i].max[j]);
      f[i].flag=0; 
     
    } 

    printf("\nEnter Available Resources\t -- \t"); 
    for(i=0;i    scanf("%d",&avail[i]);
    printf("\nEnter New Request Details -- "); 
    printf("\nEnter pid \t -- \t"); 
    scanf("%d",&id); 
    printf("Enter Request for Resources \t -- \t"); 
    for(i=0;i    { 
      scanf("%d",&newr); 
      f[id].all[i] += newr;
      avail[i]=avail[i] - newr; 
          } 
    for(i=0;i    { 
      for(j=0;j      { 
       f[i].need[j] = f[i].max[j] - f[i].all[j];
       if (f[i].need[j] < 0)
       f[i].need[j] = 0;
      }
   }

cnt = 0;
fl = 0;
while (cnt != n)
  {
    g = 0;
    for (j = 0; j < n; j++)
      {
 if (f[j].flag == 0)
   {
     b = 0;
     for (p = 0; p < r; p++)
       {
  if (avail[p] >= f[j].need[p])
    b = b + 1;
  else
    b = b - 1;
       }
     if (b == r)
       {
  printf ("\nP%d is visited", j);
  seq[fl++] = j;
  f[j].flag = 1;
  for (k = 0; k < r; k++)
  avail[k] = avail[k] + f[j].all[k];
  cnt = cnt + 1;
  printf ("(");
  for (k = 0; k < r; k++)
    printf ("%3d", avail[k]);
  printf (")");
  g = 1;
       }
   }
      }
    if (g == 0)
      {
 printf ("\n REQUEST NOT GRANTED -- DEADLOCK OCCURRED");
 printf ("\n SYSTEM IS IN UNSAFE STATE");
 goto y;
      }
  }

printf ("\nSYSTEM IS IN SAFE STATE");
printf ("\nThe Safe Sequence is -- (");
for (i = 0; i < fl; i++)
  printf ("P%d ", seq[i]);
printf (")");
y:printf ("\nProcess\t\tAllocation\t\tMax\t\t\tNeed\n");
for (i = 0; i < n; i++)
  {
    printf ("P%d\t", i);
    for (j = 0; j < r; j++)
      printf ("%6d", f[i].all[j]);
    for (j = 0; j < r; j++)
     
printf ("%6d", f[i].max[j]);
    for (j = 0; j < r; j++)
      printf ("%6d", f[i].need[j]);
    printf ("\n");
  }
}


INPUT 

Enter number of processes – 5
Enter number of resources -- 3 
Enter details for P0 
Enter allocation -- 0 1 0 
Enter Max -- 7 5 3
Enter details for P1 
Enter allocation -- 2 0 0 
Enter Max -- 3 2 2 
Enter details for P2
Enter allocation -- 3 0 2 
Enter Max -- 9 0 2 
Enter details for P3 
Enter allocation -- 2 1 1 
Enter Max -- 2 2 2
Enter details for P4 
Enter allocation -- 0 0 2 
Enter Max -- 4 3 3 
Enter Available Resources -- 3 3 2 
Enter New Request Details -- Enter pid -- 1 
Enter Request for Resources -- 1 0 2 

OUTPUT

P1 is visited( 5 3 2) 
P3 is visited( 7 4 3) 
P4 is visited( 7 4 5) 
P0 is visited( 7 5 5) 
P2 is visited( 10 5 7)
 
SYSTEM IS IN SAFE STATE

The Safe Sequence is -- (P1 P3 P4 P0 P2 ) 

Process       Allocation         Max            Need 
P0              0 1 0                  7 5 3           7 4 3 
P1              3 0 2                  3 2 2           0 2 0 
P2              3 0 2                  9 0 2           6 0 0
P3              2 1 1                  2 2 2           0 1 1
P4              0 0 2                  4 3 3           4 31

Friday, March 9, 2018

UNIT-III PPT

OS WEEKLY TEST QUESTIONS (12-3-18)



DESCRIPTIVE QUESTIONS

1. A) Define page fault. When does a page fault occur?
    B) Describe the action taken by OS when page fault occurs with diagram.

2. A)Consider the following page reference string
        7,0,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0   Assuming three frames, how
     many page faults would occur in each of the following cases:
         i) LRU                ii) FIFO

    B) State and Explain Belady’s anomaly with an example.


Fill in the blanks

1. Virtual memory is
(a) Large secondary memory (b) Large main memory
(c) Illusion of large main memory (d) None of the above

2 . Optimal page – replacement algorithm is difficult to implement, because :
a) it requires a lot of information b) it requires future knowledge of the reference string
c) it is too complex d) it is extremely expensive

3. The two methods how LRU page replacement policy can be implemented in hardware are COUNTER,REFERENCE BIT.

4. LRU stands for__________________________________________.

5. OPTIMAL PAGE REPLACEMENT yields the lowest of all possible page-faults,