answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

List four functions of registers in assembly language?

Because registers are where all the actual work is done by the CPU. Think of registers as being a bank of switches which can be configured so the CPU can perform a specific operation upon a specific set of operands, be they values or memory addresses where values can be found. Some operations have no operands while others have one or two, but in order for the CPU to know which operation and which operands it should operate upon the registers must be set accordingly. The CPU achieves this through a repeating fetch-decode-execute cycle, fetching the next instruction, decoding its operands and then executing the instruction. In a multi-threaded environment, the CPU must also save the state of the registers to allow another thread to restore those registers for itself. In this way, a single CPU can switch from one thread to another and pick up from exactly where it left off.

Which the best programming language between java and visual basic?

Java.

While Visual Basic is certainly useful for writing Windows applications, that's all it can do. If you want the same program to run on other platforms (such as Linux), the entire program must be re-written from scratch.

With Java, there is no need to convert. Once compiled, Java programs can be executed upon any platform that has a suitable Java virtual machine implementation, which is pretty much everything today.

Three address code in compiler design?

prod=0;

i=1;

do

{

prod = prod +a[i] * b[i];

i=i+1;

} while(i<=20);

What are the kinds of toolbar?

There are three types of toolbar as written bellow : 1. Menu Bar
2. Docked Toolbar
3. Built-in Toolbar.

String reverse program with single string and without using library functions in java?

You can create a separate string initially empty. Then using a loop, start at the end of the string and add it to the end of the other string. At the end of the loop, the other string would contain the reverse.

String concaination program using pointers in C?

#include<stdio.h>

#include<conio.h>

void main()

{

char a[5][10];

int i;

clrscr();

for(i=0;i<5;i++)

{

printf("enter %d string",i+1);

scanf("%s",&a[i]);

}

for(i=0;i<5;i++)

{

printf("\n%s",a[i]);

}

getch();

}

Difference between register and memory?

Registers are storage locations internal the the processor. CPU instructions operate on these values directly. On RISC processors, all data must be moved into a register before it can be operated. On CISC (Intel) chips, there are a few operations that can load data from RAM, process it, and save the result back out, but the fastest operations work directly with registers.

Also, there are registers that are set aside for certain tasks, these generally include a program counter, stack, and flags.

Each register also has a size that determines the maximum amount of data that can be processed at a time. The registers on Pentium chips, for example, are 32 bits.

Finally, there are generally only a few registers available on a processer. Intel chips, for example, have 6 general purpose registers, and several specialized registers including a base register, stack register, flags register, program counter, and some addressing registers.

Memory, or RAM, is located external to the CPU. Generally speaking, data has to be loaded into a CPU register from memory before the CPU can process it, RAM is much slower than registers, there is a lot more RAM than registers, and generally memory can be addressed on a byte boundaries, where registers may not be able to access all the bytes in a register.

To summarize: in general, registers are temporary storage in the CPU that holds the data the processor is currently working on, while RAM holds the program instructions and the data the program requires.

Hopefuly this helps,

--Eric Tolman

Write an algorithm to find the numbers divisible by 3 but not by 6 and then draw the flowchart?

Start

Input a

if a%3 = 0 then

Print a

else

print" enter another number"

end

1. start

2. Input N

3. if N<3, go to step 6

4. if N%3 && N%6!=0 then

print N

5. N=N-3 go to step 3

6. end

What is the minimum wage of UK?

This question is not very specific, I would say that the lowestofficial salary in the UK are people who are on the minimum wage generally around £12,000 a year, the minimum wage can be different for how old you are, if you are in education, or if you claim any kind of benefits.

But unofficially, there are people working for far less than that and you cannot determine there salary.

How did Bill Gates become a billionare?

he made an acount were he documented his money and then he gained intrest then 500 years later he had billions and made Microsoft

Disadvantages of using ICT in education?

Chat Online

User use chat application for their own interest.

Print Personal Stuffs

Staff will use company resources such as printer to print their personal stuff document.

Online Movie/ Radio/ Download Music

Cannot Troubleshoot Remote Computer

Cannot Track Computer Assets Changes

Administrator Faces Heavy Workload

Can computers count?

Yes, a computer can count. You could get a computer to count forever, if you wanted to. All a computer does is compute information. So yes, you could get a computer to count. But, wouldn't your fingers suffice?

Application of object-oriented programming?

Answer

A virtual function must be declared as a non-static member method of a class that you expect to act as a base class. Declaring a virtual function adds some overhead as a result of creating the v-table (virtual method table), but most of that overhead is paid with the first virtual function (subsequent virtual functions just add a new entry to the already-existing v-table). However, do not declare a virtual function unless you expect that function to be overridden. Bear in mind that overriding an overloaded, non-virtual function "hides" all the overloads in the base class.

If a virtual function must be overridden, declare it as pure-virtual instead. You do not need to implement the method in the base class, but you will be reminded to provide an implementation in the derived class at compile time if one does not exist, even if you provide a default implementation in the base class. Bear in mind that base classes with one or more pure-virtual methods become abstract -- they cannot be instantiated.

If there is any virtual function or pure-virtual function, there must also be a virtual destructor, as well as a public or protected default constructor (a constructor with no arguments). When a derived class is constructed, it calls the base class constructor, which calls its base class constructor. Derived classes are constructed in sequence, beginning with the least-derived class. Destruction is the reverse -- the most-derived class is destroyed before the base classes are destroyed.

Virtual functions can be invoked just like any other class member method, both via an object reference's member operator (.), and the indirection operator (-->) for pointers to objects. It does not matter whether the reference or pointer refers to a base class or a derived class; the v-table decides which override (where one is provided) will actually execute, starting from the most-derived override and working back towards the base class, the least-derived. With appropriate use of virtual functions, dynamic casting can be avoided completely (dynamic casting should never be employed as it completely defeats the point of having a v-table in the first place).

How do you find volume of a triangle?

Multiply the area of the base by the height of the object. The area of the base can be found by multiplying the length times the width of one of the faces.

What are the limitations of the C programming language?

An algorithm simply describes the finite, procedural steps required to solve a problem. Algorithms are not specific to any one programming language, but without algorithms there would be no computer programs let alone programming languages. That is, you cannot program a computer to solve a problem unless you know how to solve the problem yourself and for that you need to know the algorithm. Once you have the algorithm, you can program the computer to implement it.

What do you understand by static memory allocation and dynamic memory allocation?

MEMORY ALLOCATION MODELS……

STATIC MEMORY ALLOCATION DYNAMIC MEMORY ALLOCATION

Memory is allocated before the execution of the program begins.

(During Compilation)

Memory is allocated during the execution of the program.

No memory allocation or deallocation actions are performed during Execution.

Memory Bindings are established and destroyed during the Execution.

Variables remain permanently allocated.

Allocated only when program unit is active.

Implemented using stacks and heaps.

Implemented using data segments.

Pointer is needed to accessing variables.

No need of Dynamically allocated pointers.

Faster execution than Dynamic.

Slower execution than static.

More memory Space required.

Less Memory space required.

How do you Write a program that allows the user to input a number and compute for the sum difference product and quotient in simple way?

You cannot compute the sum, difference, product or quotient of a single number. All these operations are binary operations which means they require two operands, which we'll call aand b.

In pseudocode, our program will be something like the following:

input a

input b

print "sum = "

print a + b

print "difference = "

print a - b

print "product = "

print a * b

print "quotient = "

print a / b

This could be implemented in C++ as follows:

#include

int main (void) {

using namespace std;

double a, b;

cin >> a >> b;

cout << "Sum = " << a + b << endl;

cout << "Difference = " << a - b << endl;

cout << "Product = " << a * b << endl;

cout << "Quotient = " << a / b << endl;

}

This is as simple as it gets. A more robust program will take the input as a string and parse it accordingly, thus handling any input error more gracefully.

What is j2ee j2se j2me?

J2EE = enterprise edition jdk. J2SE = standard edition jdk. J2ME = mobile edition jdk. standard jdk gets used for platform development, enterprise jdk for enterprise development and mobile jdk gets used for mobile development.

How much money do game developers make a month?

Being a computer scientist is a well paying job. They make on average $5000 to $8000 per month. And job prospective are very good.

Why ASCII has 8 bits only?

Answer to Why ASCII has only 255 codesAs you know the alphabet has 26 letters. If you include capital letter that would be 52. There is also lots of punctuation, digits we end up with 127. But there is other function buttons (example. Ctrl + Alt + Del) we need to get more space.

If we use 7 binary digits (Computers counting systems is binary) we end up with 127. That isn't enough to hold all the characters. So we make it 8 binary digits. The maximum number for 8 binary digits is 11111111. Which in our counting system is 255.

AnswerASCII is a 7-bit character encoding, so it has only 128 codes: 0 through 127. The upper 128 codes in an 8-bit byte (128 through 255) are unused and undefined by ASCII, but many ASCII extensions (such us ISO-8859-1) make use of those unused codes.

What is the difference between an array of structures and an array within a structure?

The main differences between an array and a structure are:

An Array is a collection of similar data items.An array is derived data type.It behave like a built in data type. An array can be increased or decreased.

A structure is a collection of dissimilar data items.It is a user defined data types.It must be declared and defined.A structure element can be added if necessary.

A first-generation contact language is called a?

A first generation contact language is called a pigdin. The feature of human language that allows people to talk about the past and the future is referred to as displacement.

What is the difference between javascript and C programming language?

Mainly JavaSript is a low-level scripting language that differs from the high-level languages in its easiness. The core language is really simple, and is designed to be easier for beginners,

I.e. JS i loosly typed. Meaning that a variable can reference any kind of literal, array or object, which differs from the high-level C-languages where you have to declare if a variable i to reference an integer, floating-point, string, hash-map and so on.

Another major difference is that JS, like python or php isn't compiled to machine code, but interpreted at runtime, making programs run significantly slower than compiled programs.

Another difference which is good, and unique to JS is that it does not inherit the C class model when working in OOP. Objects in JavaScripts can be crated and altered as one want to, beeing more dynamic to work with. A classical model can however be adopted with use of functions and use of the 'new' keyword. Here the lack of private variables can be worked around by the use of a technique called 'closure'.

The major difference however is that programs written in JS to work with the HTML DOM tend to not follow the normal procedural 'step-by-step' executions as conventional programs, where one line of code is being executed at the time. In stead JS tend to follow a Event Loop model, where different parts of the programs are attached to different DOM events. The JS-program will then sleep until a event is fired, then wake up, do its job, then go back to sleep. And so on. All in all making JS a very dynamic and "fun to work with" language.