answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

What happens when you debug your program?

When you debug your program, you systematically identify and resolve errors or bugs in the code. This process often involves running the program in a controlled environment, using tools to inspect variables, step through code execution, and analyze the program's behavior. As you identify issues, you make necessary code adjustments and test to ensure that the fixes work without introducing new problems. Ultimately, debugging helps improve the program's reliability and functionality.

Show you with detailed of assembly codes of emu8086 assemblers?

; count_chars.asm ; counts the number of characters of a zero terminated string. name "counter" org 100h jmp start str1 db 'abcdefg hijklmnop qrstvuwxyz', 0 start: lea bx, str1 ; load address of string. mov ax, 0 ; reset counter. compare: cmp [bx], 0 ; is it end of string? je done ; if zero, then it's the end. inc ax ; count char. inc bx ; next memory position in string. jmp compare ; print result in binary: done: mov bx, ax mov cx, 8 print: mov ah, 2 ; print function. mov dl, '0' test bl, 10000000b ; test first bit. jz zero mov dl, '1' zero: int 21h shl bl, 1 loop print ; print binary suffix: mov dl, 'b' int 21h ; wait for any key press.... mov ah, 0 int 16h ret

; ; count_chars.asm ; counts the number of characters of a zero terminated string. name "counter" org 100h jmp start str1 db 'abcdefg hijklmnop qrstvuwxyz', 0 start: lea bx, str1 ; load address of string. mov ax, 0 ; reset counter. compare: cmp [bx], 0 ; is it end of string? je done ; if zero, then it's the end. inc ax ; count char. inc bx ; next memory position in string. jmp compare ; print result in binary: done: mov bx, ax mov cx, 8 print: mov ah, 2 ; print function. mov dl, '0' test bl, 10000000b ; test first bit. jz zero mov dl, '1' zero: int 21h shl bl, 1 loop print ; print binary suffix: mov dl, 'b' int 21h ; wait for any key press.... mov ah, 0 int 16h ret

;

Can Mathematica be used for AI Programming?

The short answer is yes. Any full language is capable of this.

You might want to look at the book "Illustrating Evolutionary Computation with Mathematica", for some examples.

Are the variables argc and argv are local to main?

Answer

yes they are local to main


Answerargc and argv can be used as variable names anywhere in a C program. If they are declared as arguments to main() then they are local to main:

int main(int argc, char *argv[])
{
// argc and argv are local to main in this short program
return 0;
}

How do you check if another batch file exists when using batch files?

IF EXIST "P:\a\t\h\FileName.bat" Command

If you need to include multiple commands however, use this:

IF NOT EXIST "P:\a\t\h\FileName.bat" GOTO NotExist

Command

Command

Command

GOTO Done

:NotExist

Command

Command

Command

GOTO Done

:Done

That should just help you keep your file organized.

How does a client determine the host name of the client computer?

Most operating systems have a methodology for determining the host name of a client. On the command line, the command is usually 'hostname', for both Windows and Unix/Linux.

From the GUI Windows perspective, looking at the System or Computer properties will reveal the hostname.

How do you combine 3 parts into 1 iso?

Simply open Commmand Prompt. Navigate to the folder that contains all the parts, and enter this command: copy /b example1.iso + example2.iso + example3.iso + example4.iso finishedexample.iso . This works only with windows cmd of course.

Write a program t remove the occurrences of word in entered text in c?

#include

#include

#define n 100

void del_char(char str1[n],char str2[])

{

char str[n],*p1,*q,i,j;

p1=str1;

q=str;

*q=*p1;

i=0;

while(*p1!='\0')

{

{

if(*p1==str2[i])

{

p1++;

i++;

if(*p1==str2[i])

{

p1++;

i++;

if(*p1==str2[i])

{

p1++;

i++;

}

else

{

q++;

}

}

else

{

q++;

}

}

else

{

p1++;

q++;

}

*q=*p1;

}

i=0;

}

printf("%s\n",str);

}

main()

{

char str1[n],str2[]={"to "};

clrscr();

printf("please enter a text and includ 'to':\n");

gets(str1);

printf("remove 'to',remaining :\n");

del_char(str1,str2);

getch();

return 0;

}

Output:

please enter a text and includ 'the':

Write a c program to simulate the calculator using function

remove 'the',remaining :

Write a c program to simulate calculator using function

Discuss the service primitives in a client server model?

A service is formally specified by a set of primitives or operations available to the user to access the service. These primitives tell the service to perform some action or report an action taken by the peer entity. The primitives for the connection oriented service are given in following table. Primitives Meaning Listen Block waiting for an incoming connection Connect Establish a connection with waiting peer Receive Block waiting for an incoming message Send Send a message to the peer Disconnect Terminate a connection Table: - Service primitives for a connection oriented service Communication in a simple client server model using the above service primitives is illustrated in figure [A]. First the server executes LISTEN to indicate that it is ready to accept incoming connections. The client executes CONNECT (1) to establish the connection with the server. The server now unblocks the listener and sends back an acknowledgement (2). Thus the connection is established. Figure [A]:- Simple client server model on a connection oriented network
The next step for a server is to execute RECEIVE (3) to prepare to accept the first request. The arrival of the request packet unblocks the server so that it can process the request. After it has done the work it uses SEND (4) to answer to the client. After all the data transfer is done it can use DISCONNECT (5) for suspending the client. When the server gets this packet, it also issues a DISCONNECT (6) and when it reaches the client, the client process is releases and the connection is broken. In the process packets may get lost, timings may be wrong; many other complex issues may arise. The Relationship of Services to Protocols Figure [B]: Relationship between the service and protocols A service is a set of primitives that a layer provides to the layer above it. The service defines what operation the layer is prepared to perform on behalf of its users. It says nothing about the implementation of these operations. A protocol is a set of rules governing the format and meaning of the packets, or messages that are exchanged by the peer entities within a layer. Figure [B] illustrates the relationship of services to protocols. Entities use protocols to implement their service primitives. Protocols relate to the packets sent between entities.

What are interactive elements?

interactive elements are aspects of an object that relate to how they are demonstrated and can be displayed and played with.

What is multi user multi task?

Multi User: In the computer usage, if there are more CPUs and more users are connected to the same computer with more cpu buit into it. So that any user request may be diverted in to the idle cpus in the gang. The no. of cpus in the gang will be decided by the traffic of the no. of users. This concept is helpful for the real time jobs.

Multi Programming: in which there is only one cpu with many programs that can be run. However, in the same machine we have to submit more jobs. Here the process may not be real time jobs. Because if one job completes inside the CPU then only the other jobs may enter into CPU for its turns.

In this case Multiprogramming; the time sharing concepts may be introduced to allocate job run time for important programs with high priority.

What is the difference between compilar and interpreter?

compiler is a software translator used in ProgrammingLanguage: C,C++, Java etc ). This used for to translate High level language to Machine independent language.

Interpreter is used to translate source code to machine code by line by line.

ALP program for palindrome number in 8086?

Data segment

msg1 db 10,13,'enter the string: $'

msg2 db 10,13,'string is palindrome$'

msg3 db 10,13,'string is not palindrome$'

new db 10,13,'$'

inst db 20 dup(0)

data ends

code segment

assume cs:code,ds:data

start:

mov ax,data

mov ds,ax

lea dx,msg1

mov ah,09h

int 21h

mov bx,00

up:

mov ah,01h

int 21h

cmp al,0dh

je down

mov [inst+bx],al

inc bx

loop up

down:

mov di,0

dec bx

jnz check

check:

mov al,[inst+bx]

cmp al,[inst+di]

jne fail

inc di

dec bx

jnz check

lea dx,new

mov ah,09h

int 21h

lea dx,msg2

mov ah,09h

int 21h

jmp finish

fail:

lea dx,msg3

mov ah,09h

int 21h

finish:

int 3

code ends

end start

end

What are the differences between machine languages and high level languages?

Machine language is something which can be understood by machine(Computer), it can understand only 0 and 1 i.e. the binary code.

High level language is something which can be understood by human beings.. for ex... english.

Disadvantages of non-verble communication?

Disadvantages of non verbal communication are: 1.this may result in confusion or communication failiure also. 2.non verbal communication may suffice in itself. 3.it may also create miss understandings also.