SE COMP
Friday, 6 November 2015
Total No. of Questions—8] [Total No. of Printed Pages—4
Se at
No. [4657]-573
S.E. (Computer Engineering) (I Semester) EXAMINATION, 2014
DIGITAL ELECTRONICS AND LOGIC DESIGN
(2012 PATTERN)
Time : Two Hours Maximum Marks : 50
N.B. :— (i) Attempt Q. No. 1 or Q. No. 2, Q. No. 3 or Q. No. 4,
Q. No. 5 or Q. No. 6 and Q. No. 7 or Q. No. 8.
(ii) Figures to the right indicate full marks.
(iii) Assume suitable data, if necessary.
1. (a) Do the following conversions : [6]
(i) (101110.0101)2 ( )10
(ii) (432A)16 ( )2
(iii) (428.10)10 ( )2
P.T.O.
[4657]-573 2
(b) Reduce the following using K-map techniques : [4]
f(A, B, C, D) = (0, 2, 3, 8, 9, 12, 13, 15).
(c) What is logic family ? Give the classification of logic family. [2]
Or
2. (a) Minimize the following expression using Quine-McClusky : [6]
f(A, B, C, D) = m (0, 2, 3, 6, 7, 8, 10, 12, 13).
(b) Explain with neat diagram two input CMOS NAND gate. [6]
3. (a) Explain Look Ahead Carry generator in detail. [6]
(b) Explain with neat diagram working of serial- n serial-out 4-bit
shift register. Draw necessary timing diagram. [6]
Or
4. (a) Explain rules for BCD addition with suitable example and design
one digit BCD adder using IC 7483. [6]
(b) Design given sequence generator using J-K FF. Sequence is
1 3 5 6 7 1 [6]
[4657]-573 3 P.T.O.
5. (a) Draw the ASM chart for the following state machine. A 2-bit up
counter is to be designed with output QAQB, and enable signal ‘X’.
If X = 0, then counter changes the state as 00 —01 — 10— 11
— 00. If ‘X’ = 1, then counter should remain in current state.
Design the circuit using JK-FF and suitable MUX. [7]
(b) Write VHDL code for 4-bit adder using structural modeling
style. [6]
Or
6. (a) Write a VHDL code for 8 : 1 MUX using Behavioural
modeling. [7]
(b) Draw an ASM chart, state diagram and state table for synchronous
circuit having the following description.
The circuit has control input C, clock and outputs x, y, and z.
(i) If C = 1, on every clock rising edge the code on output x,
y and z changes from 000 — 010 —100 — 110 — 000 and
repeats.
[4657]-573 4
(ii) If C = 0, the circuit holds the present state. [6]
7. (a) Draw and explain Basic architecture of FPGA in detail. [6]
(b) Implement the following functions using PLA : [7]
f1(A, B, C) = m(0, 3, 4, 7)
f2(A, B, C) = m(1, 2, 5, 7).
Or
8. (a) A combinational circuit is defined by the functions :
f1(A, B, C) = m(3, 5, 7)
f2(A, B, C) = m(4, 5, 7).
Implement the circuit with PLA having 3 input and 3 product
term with 2 output. [7]
(b) Implement 4 : 1 MUX using PAL. [6]
Wednesday, 7 October 2015
shortest path
#include<stdio.h>
#include<conio.h>
#define MAX 1000
void dijkstra(int n,int v,int cost[10][10],int dist[10]);
int main()
{
int n,v,i,j,cost[10][10],dist[10];
clrscr();
printf("\n Enter the number of Nodes: ");
scanf("%d",&n);
printf("\n Enter the Weight Matrix:\n");
printf("\nEnter 1000 to denote Infinity\n");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&cost[i][j]);
}
}
printf("\n Enter the Source Node:");
scanf("%d",&v);
dijkstra(n,v-1,cost,dist);
printf("\n Shortest Path from Node : %d",v);
printf("\n#################################\n\n");
for(i=0;i<n;i++)
{
printf("Distance to Node: %d is %d\n",i+1,dist[i]);
}
return 0;
}
void dijkstra(int n,int v,int cost[10][10],int dist[10])
{
int i,u,count,w,flag[10],min;
for(i=0;i<n;i++)
{
flag[i]=0;
dist[i]=cost[v][i];
}
count=1;
while(count<n)
{
min=MAX;
for(w=0;w<n;w++)
{
if(dist[w]<min && !flag[w])
{
min=dist[w];
u=w;
}
}
flag[u]=1;
count++;
for(w=0;w<n;w++)
{
if((dist[u]+cost[u][w]<dist[w])&&!flag[w])
{
dist[w]=dist[u]+cost[u][w];
}
}
}
}
#include<conio.h>
#define MAX 1000
void dijkstra(int n,int v,int cost[10][10],int dist[10]);
int main()
{
int n,v,i,j,cost[10][10],dist[10];
clrscr();
printf("\n Enter the number of Nodes: ");
scanf("%d",&n);
printf("\n Enter the Weight Matrix:\n");
printf("\nEnter 1000 to denote Infinity\n");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&cost[i][j]);
}
}
printf("\n Enter the Source Node:");
scanf("%d",&v);
dijkstra(n,v-1,cost,dist);
printf("\n Shortest Path from Node : %d",v);
printf("\n#################################\n\n");
for(i=0;i<n;i++)
{
printf("Distance to Node: %d is %d\n",i+1,dist[i]);
}
return 0;
}
void dijkstra(int n,int v,int cost[10][10],int dist[10])
{
int i,u,count,w,flag[10],min;
for(i=0;i<n;i++)
{
flag[i]=0;
dist[i]=cost[v][i];
}
count=1;
while(count<n)
{
min=MAX;
for(w=0;w<n;w++)
{
if(dist[w]<min && !flag[w])
{
min=dist[w];
u=w;
}
}
flag[u]=1;
count++;
for(w=0;w<n;w++)
{
if((dist[u]+cost[u][w]<dist[w])&&!flag[w])
{
dist[w]=dist[u]+cost[u][w];
}
}
}
}
news paper using kruskal alog
#include<iostream.h>
#include<stdio.h>
int parent[10]; //initial value 0 due to global initialization
class kruskal
{
int a,b,u,v,i,j,n,noofedges;
int visited[10],min,mincost,cost[10][10];
public:
kruskal()
{
noofedges=1;
mincost=0;
}
void read();
void kruskals(int cost[][10],int n);
};
void kruskal::read()
{
cout<<"Enter the no. of vertices";
cin>>n;
cout<<"Enter the adjacency matrices";
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
cin>>cost[i][j];
if(cost[i][j]==0)
cost[i][j]=999;
}
kruskals(cost,n);
}
void kruskal::kruskals(int cost[][10],int n)
{
cout<<"The minimum cost edges are \n";
while(noofedges<n)
{
min=999;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(cost[i][j]<min)
{
min=cost[i][j];
a=u=i;
b=v=j;
}
while(parent[u])
u=parent[u];
while(parent[v])
v=parent[v];
if(u!=v)
{
noofedges++;
cout<<"\n Edge ( "<<a<<"->"<<b<<")"<<min;
mincost+=min;
parent[v]=u;
}
cost[a][b]=cost[b][a]=999;
}
cout<<"\n \n Minimum cost \t"<<mincost<<" ";
}
main()
#include<stdio.h>
int parent[10]; //initial value 0 due to global initialization
class kruskal
{
int a,b,u,v,i,j,n,noofedges;
int visited[10],min,mincost,cost[10][10];
public:
kruskal()
{
noofedges=1;
mincost=0;
}
void read();
void kruskals(int cost[][10],int n);
};
void kruskal::read()
{
cout<<"Enter the no. of vertices";
cin>>n;
cout<<"Enter the adjacency matrices";
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
cin>>cost[i][j];
if(cost[i][j]==0)
cost[i][j]=999;
}
kruskals(cost,n);
}
void kruskal::kruskals(int cost[][10],int n)
{
cout<<"The minimum cost edges are \n";
while(noofedges<n)
{
min=999;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(cost[i][j]<min)
{
min=cost[i][j];
a=u=i;
b=v=j;
}
while(parent[u])
u=parent[u];
while(parent[v])
v=parent[v];
if(u!=v)
{
noofedges++;
cout<<"\n Edge ( "<<a<<"->"<<b<<")"<<min;
mincost+=min;
parent[v]=u;
}
cost[a][b]=cost[b][a]=999;
}
cout<<"\n \n Minimum cost \t"<<mincost<<" ";
}
main()
java program for queue
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.awt.Graphics;
public class queue extends Applet implements ActionListener {
TextField t1, t2;
Button b1, b2, b3, b4;
TextArea T;
static int n;
int i, front=0, rear=0, item, count=0;
String s1, s2;
int queue[];
public void init() {
t1 = new TextField(10);
add(t1);
t1.setText("");
Button b4 = new Button("queue Limit");
add(b4);
b4.addActionListener(this);
t2 = new TextField(10);
add(t2);
t2.setText("");
Button b1 = new Button("Push");
add(b1);
b1.addActionListener(this);
Button b2 = new Button("Pop");
add(b2);
b2.addActionListener(this);
Button b3 = new Button("Display");
add(b3);
b3.addActionListener(this);
T = new TextArea(20, 30);
add(T);
}
public void actionPerformed(ActionEvent e){
Button source = (Button)e.getSource();
if(source.getLabel() == "queue Limit"){
try {
s1 = t1.getText();
n = Integer.parseInt(s1);
queue = new int[n];
}
catch(Exception e1) {
System.out.println(e1.getMessage());
}
}
if(source.getLabel() == "Push"){
try {
if(count < n) {
s2 = t2.getText();
item = Integer.parseInt(s2);
queue[rear]=item;
t2.setText("");
rear++;
count++;
}
else{
T.setText("");
T.setText("queue IS FULL\n");
t2.setText("");
}
}
catch(Exception e1) {
System.out.println(e1.getMessage());
}
}
if (source.getLabel() == "Pop") {
if(count!=0) {
T.setText("");
T.setText("The item deleted is: "+queue[front]+"\n");
front++;
count--;
}
else{
T.setText("");
T.setText("queue IS EMPTY\n");
}
if(rear==n)
rear=0;
}
if (source.getLabel() == "Display") {
int m=0;
T.setText("");
if(count==0) {
T.setText("");
T.setText("queue IS EMPTY\n");
}
else {
for(i=front;m<count;i++,m++)
T.append(" "+queue[i]);
}
}
}
}
import java.applet.*;
import java.awt.event.*;
import java.awt.Graphics;
public class queue extends Applet implements ActionListener {
TextField t1, t2;
Button b1, b2, b3, b4;
TextArea T;
static int n;
int i, front=0, rear=0, item, count=0;
String s1, s2;
int queue[];
public void init() {
t1 = new TextField(10);
add(t1);
t1.setText("");
Button b4 = new Button("queue Limit");
add(b4);
b4.addActionListener(this);
t2 = new TextField(10);
add(t2);
t2.setText("");
Button b1 = new Button("Push");
add(b1);
b1.addActionListener(this);
Button b2 = new Button("Pop");
add(b2);
b2.addActionListener(this);
Button b3 = new Button("Display");
add(b3);
b3.addActionListener(this);
T = new TextArea(20, 30);
add(T);
}
public void actionPerformed(ActionEvent e){
Button source = (Button)e.getSource();
if(source.getLabel() == "queue Limit"){
try {
s1 = t1.getText();
n = Integer.parseInt(s1);
queue = new int[n];
}
catch(Exception e1) {
System.out.println(e1.getMessage());
}
}
if(source.getLabel() == "Push"){
try {
if(count < n) {
s2 = t2.getText();
item = Integer.parseInt(s2);
queue[rear]=item;
t2.setText("");
rear++;
count++;
}
else{
T.setText("");
T.setText("queue IS FULL\n");
t2.setText("");
}
}
catch(Exception e1) {
System.out.println(e1.getMessage());
}
}
if (source.getLabel() == "Pop") {
if(count!=0) {
T.setText("");
T.setText("The item deleted is: "+queue[front]+"\n");
front++;
count--;
}
else{
T.setText("");
T.setText("queue IS EMPTY\n");
}
if(rear==n)
rear=0;
}
if (source.getLabel() == "Display") {
int m=0;
T.setText("");
if(count==0) {
T.setText("");
T.setText("queue IS EMPTY\n");
}
else {
for(i=front;m<count;i++,m++)
T.append(" "+queue[i]);
}
}
}
}
dictionary
#include<iostream.h>
#include<conio.h>
#include<string.h>
struct dict
{
char key[20];
char mean[20];
};
void main()
{
int n,i,f=0;
char k[20];
clrscr();
cout<<"\t\t\t\tDictionary Dpcoe\n\n\n\n" ;
//insert operation
struct dict d[30];
cout<<"how many key u want to enter\n";
cin>>n;
//insret
for(i=1;i<=n;i++)
{
cout<<"enter key:\t";
cin>>d[i].key;
cout<<"enter meaning\t" ;
cin>>d[i].mean;
}
//diplay
cout<<"key \t mean \n" ;
//display
for(i=1;i<=n;i++)
{
cout<<d[i].key<<"\t";
cout<<d[i].mean<<"\n";
}
cout<<"enetr key to serch\n" ;
cin>>k;
// logic for search oprration
for(i=1;i<=n;i++)
{
if(strcmp(d[i].key,k)==0)
{
cout<<"meaninig is \t";
cout<<d[i].mean;
f=1;
}
}
if(f==0)
{ cout<<"update key\n" ;
}
//update
cout<<"enetr key to be updated\n" ;
cin>>k;
for(i=1;i<=n;i++)
{
if(strcmp(d[i].key,k)==0)
{
cout<<"meaninig to be updated \t";
cin>>d[i].mean;
}
}
//diply updated:
cout<<"updated dictionary is\n" ;
for(i=1;i<=n;i++)
{
cout<<d[i].key<<"\t";
cout<<d[i].mean<<"\n";
}
getch();
}
#include<conio.h>
#include<string.h>
struct dict
{
char key[20];
char mean[20];
};
void main()
{
int n,i,f=0;
char k[20];
clrscr();
cout<<"\t\t\t\tDictionary Dpcoe\n\n\n\n" ;
//insert operation
struct dict d[30];
cout<<"how many key u want to enter\n";
cin>>n;
//insret
for(i=1;i<=n;i++)
{
cout<<"enter key:\t";
cin>>d[i].key;
cout<<"enter meaning\t" ;
cin>>d[i].mean;
}
//diplay
cout<<"key \t mean \n" ;
//display
for(i=1;i<=n;i++)
{
cout<<d[i].key<<"\t";
cout<<d[i].mean<<"\n";
}
cout<<"enetr key to serch\n" ;
cin>>k;
// logic for search oprration
for(i=1;i<=n;i++)
{
if(strcmp(d[i].key,k)==0)
{
cout<<"meaninig is \t";
cout<<d[i].mean;
f=1;
}
}
if(f==0)
{ cout<<"update key\n" ;
}
//update
cout<<"enetr key to be updated\n" ;
cin>>k;
for(i=1;i<=n;i++)
{
if(strcmp(d[i].key,k)==0)
{
cout<<"meaninig to be updated \t";
cin>>d[i].mean;
}
}
//diply updated:
cout<<"updated dictionary is\n" ;
for(i=1;i<=n;i++)
{
cout<<d[i].key<<"\t";
cout<<d[i].mean<<"\n";
}
getch();
}
bubble sort
# Program Name: Bubble Sort using python
#array[] contains the element that we want to sort
array = [2,5,4,1,7]
#BUBBLE SORT LOGIC
swapped = True
while (swapped):
swapped = False
for i in range(0,len(array)-1):
if (array[i] > array[i+1]):
temp = array[i]
array[i] = array[i+1]
array[i+1] = temp
swapped = True
# PRINT THE SORTED ARRAY
print (array)
#array[] contains the element that we want to sort
array = [2,5,4,1,7]
#BUBBLE SORT LOGIC
swapped = True
while (swapped):
swapped = False
for i in range(0,len(array)-1):
if (array[i] > array[i+1]):
temp = array[i]
array[i] = array[i+1]
array[i+1] = temp
swapped = True
# PRINT THE SORTED ARRAY
print (array)
Subscribe to:
Comments (Atom)