answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

Write a programme in 8086 assembly language that accepts two input digits and creates a packed BCD number in AL register?

There should be a jump over the variables/array declaration:

org 100h

jmp code

myArray dw 2, 12, 8, 52, 108

code: mov si, 0

mov ax, myArray[si]

ret

For the computer all bytes look the same, it cannot determine if it's an instruction or a variable. Here is an example of MOV AL, 5 instruction that can be coded with simple variable declarations:

org 100h

byte1 db 176

byte2 db 5

ret

When you run this program in emulator you can see that bytes 176 and 5 are actually assembled into:

MOV AL, 5

This is very typical for Von Neumann Architecture to keep data and instructions in the same memory, It's even possible to write complete program by using only DB (define byte) directive.

org 100h

db 235 ; jump...

db 6 ; 6 - six bytes forward (need to skip characters)

db 72 ; ascii code of 'H'

db 101 ; ascii code of 'e'

db 108 ; ascii code of 'l'

db 108 ; ascii code of 'l'

db 111 ; ascii code of 'o'

db 36 ; ascii code of '$' - DOS function prints until dollar.

db 186 ; mov DX, .... - DX is word = two bytes

db 2 ; 02 - little end

db 1 ; 01 - big end

db 180 ; mov AH, ....

db 9 ; 09

db 205 ; int ...

db 33 ; 21h - 33 is 21h (hexadecimal)

db 195 ; ret - stop the program.

8086 and all other Intel's microprocessors store the least significant byte at a lower address. 102h is the address of 'H' character = org 100h + 2 bytes (jmp instruction). The above assembly code produces identical machine code to this little program:

org 100h

jmp code

msg db 'Hello$'

code: mov DX, offset msg

mov AH, 9

int 21h

ret

If you open the produced ".com" file in any hex editor you can see hexadecimal values, every byte takes two hexadecimal digits, for example 235 = EB, etc... memory window of the emulator shows both hexadecimal and decimal values.

What is sparce array?

sparse array is one which has contents lower than its maximum size, that is the array has free or empty locations....

What is a singly liked list?

I believe it's simply a list of objects, with each object pointing to the next object. There is a value which keeps track of the list location (the head). Also the last object points to null.

head ----- data|pointer -----> data|pointer -----> data|pointer -----> data|NULL

This is a very basic form of such a list, and it's pretty inefficient, especially when it comes to adding values to the end of the list. A way to improve that would be to add a 'tail' variable so the last value can be easily found.

What is an object function?

A function object is a computer programming construct allowing an object to be invoked or called as if it were an ordinary function, usually with the same syntax ...

What are the functions of POP?

POP is Procedural Oriented Programming, this is an approach in which a problem is solved by breaking it into step by step phases of a full procedure.

C is a Programming Language is based on this approach.

How operating system performs in peripheral management?

Operating systems manage peripherals through a component called device drivers, which act as intermediaries between the hardware and the software applications. They handle communication by translating high-level commands from the OS into device-specific instructions. The OS also employs system calls to facilitate input and output operations, managing data transfer and ensuring that multiple applications can access peripherals without conflict. Additionally, the OS may implement buffering and caching to optimize performance and reduce latency in peripheral interactions.

Is there any pointer called ds cs es ss pointer in C programming?

yes, ds cs es ss are pointers available in c which is used to refer memory segments

What is 3.1 as a fraction?

-.31 = -31/100

-.31 = -31/100

-.31 = -31/100

-.31 = -31/100

What country is the least technologically advanced?

Zimbabwe has the lowest GDP per capita (per person) and has recently experienced hyper inflation.

Two Binary Trees are similar if they are both empty or if they are both non-empty and left and right sub trees are similar Write an algorithm to determine if two Binary Trees are similar?

/*

Given two trees, return true if they are

structurally identical.

*/

int sameTree(struct node* a, struct node* b) {

// 1. both empty -> true

if (a==NULL && b==NULL) return(true);

// 2. both non-empty -> compare them

else if (a!=NULL && b!=NULL) {

return(sameTree(a->left, b->left) &&

sameTree(a->right, b->right)

);

}

// 3. one empty, one not -> false

else return(false);

}

What are the different methods of storing data in a program?

Program data can be stored in the program's data segment, on the stack or on the heap. Constants, static variables and global variables are always stored in the program's data segment. Local variables are always stored on the stack. Dynamic variables are always stored on the heap.

User data is typically stored in files, but those files could exist literally anywhere, such as a local hard-disk drive, a file-server or "the cloud". However, data must be brought into working memory in order to operate upon it. Small amounts of data can be allocated within the data segment via static variables but generally you will use the heap. If the data is too large to fit into working memory all at once, use one or more temporary files on one or more local hard-disk drives and pull in what you need as and when you need it.

Why does It say failed to load the launcher DLL when you try to play portal 2?

Go to the Library in Steam,

right click Portal 2>Properties>Local Files>Verify Integrity of game cache,

then wait for it to finish and try to launch the game again.

Difference between declaring a variable and definition a variable?

Declaration is a promise: 'I will define (or has defined) this variable/function somewhere else'.

How can you capture a signature electronically?

There are several techniques

  • Use a scanner device to scan a signature into computer.
  • Use a signature capture pad - these can be attached to your computerso you can sign with a pen. For example - see manufactures: TOPAZ or WACOM
  • Some handheld computers and PDAs come with built in signature capture support.
  • Use a software component like Bennet-Tec Web Signature - allows you to capture a signature within a web page or custom software application

If you mean 'electronic signature', this is a different thing - it can refer to a method of electronically verifying that a document ( possibly including a written signature ) has not changed after the "electronic signature" process.

Write a program to generate numbers between 1 and 100 which are divisible by 2 and not divisible by 3 and 5?

To check for divisibility, use the modulus, or % operator. If the expression results in zero, then the first number is divisible by the second number. For example, 10%5 equals 0 because 10 is divisible by 5. When the expression does not result in 0, the number is not divisible(10%7=3, so 10 is not divisible by 7).