Showing posts with label cs401 assignment 2 solution. Show all posts
Showing posts with label cs401 assignment 2 solution. Show all posts

Tuesday, 16 January 2018

Download CS401 Assignment No 2 Solution File

22:22 0
[org 0x0100]
jmp start
message: db 'MC170202078' ; string to be printed
length: dw 20 ; length of string
clrscr: push es
push ax
push cx
push di
mov ax, 0xb800
mov es, ax ; point es to video base
xor di, di ; point di to top left column
mov ax, 0x0720 ; space char in normal attribute
mov cx, 2000 ; number of screen locations
cld ; auto increment mode
rep stosw ; clear the whole screen
pop di
pop cx
pop ax
pop es
ret
; subroutine to print a string
; takes the x position, y position, attribute, address of string and
; its length as parameters
printstr: push bp
mov bp, sp
push es
push ax
push cx
push si
push di
mov ax, 0xb800
mov es, ax ; point es to video base
mov al, 80 ; load al with columns per row
mul byte [bp+10] ; multiply with y position
add ax, [bp+12] ; add x position
shl ax, 1 ; turn into byte offset
mov di,ax ; point di to required location
mov si, [bp+6] ; point si to string
mov cx, [bp+4] ; load length of string in cx
mov ah, [bp+8] ; load attribute in ah
cld ; auto increment mode
nextchar: lodsb ; load next char in al
stosw ; print char/attribute pair
loop nextchar ; repeat for the whole string
pop di
pop si
pop cx
pop ax
pop es
pop bp
ret 10
start: call clrscr ; call the clrscr subroutine
mov ax, 10
push ax ; push x position
mov ax, 15;
push ax ; push y position
mov ax, 0x12 ; blue on black attribute
push ax ; push attribute
mov ax, message
push ax ; push address of message
push word [length] ; push message length
call printstr ; call the printstr subroutine
mov ax, 0x4c00 ; terminate program
int 0x21

Screen Shoots:



Download Cs401 Assignment 2 In Doc Format:


CS402 Assignment No 02 Solution

20:07 0
Question No 1:                                                                                                              Marks:5+5+5=15
Consider the following two regular languages:

Let L1 be the language defined over alphabet ∑={a    b} that contains all strings starting with alphabet a. (Example strings abbababa, aaaab, abaabbbb)
Let L2 be the language defined over alphabet ∑={a    b} that contains all strings in which alphabet a comes in the string in even number. (Example strings aba, bbabaaab, abaabba)


Construct the corresponding FAs of above languages. Construct the transition table for the intersection of above regular languages and a corresponding transition diagram for (FA1FA2).

CS402 Assignment Solution: