answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

What is interrupt in assembly language?

An interrupt (for example, Intel-based opcode 0xCD) causes the CPU to pause its current execution, store the state of the registers on the stack, then process a defined subroutine. When this subroutine completes, the interrupt finishes, the registers are restored from the stack, and the previous execution state resumes. Interrupts come in two basic flavors: hardware and software.

A hardware interrupt occurs when a connected piece of hardware raises an IRQ signal. This mechanism tells the CPU that the hardware has information that needs to be processed. This is more efficient than polling for devices that have relatively few inputs or that have a latency that the CPU shouldn't wait for. Keyboards and mice are often interrupt-driven; the CPU only needs to know when something interesting has happened (a key was pressed or the mouse was moved, for example). Hard drives are also interrupt-driven; this allows the hard drive to locate the requested data and then return that data some CPU cycles later without the CPU having to request the status of the operation repeatedly.

In contrast, a software interrupt is usually triggered by software as a means of invoking operating system code in a reliable manner. For example, in MS-DOS, a developer would call INT 0x21 in order to invoke typical DOS commands, such as reading or writing a file, obtaining keyboard input, and other basic operations. Most older operating systems running on Intel-compatible processors use software interrupts to provide a way for the program to access system functions. Newer operating systems use new opcodes that circumvent the need for software interrupts, although most platforms still provide this mechanism for legacy software.

Why were high-level languages developed?

Because machine-language programming is extremely time-consuming, programmers began using English-like abbreviations to code the programs. High-level languages were developed to improve programming efficiency by requiring fewer coding statements.

How is a programming language made?

Programming languages are extremely complex to make, but essentially, you have to first design what the purpose of your language is. Then, you have statements, errors, and other objects to write. This is really just the part that is extremely hard to do. For example: even Visual Basic 6 is very complex, having lots and lots of possible syntax errors, you would have to program that all in. Finally you would have to program your compiler or assembly-thingie. This is pretty hard to do, as well, as you would have to gather all the possible syntax and run-time errors as well. Then you're done, except for the possible innumerable number of bugs that may be left over.

What is medium programming language?

actually it is the c which is known as medium level language because it can perform operations bit by bit as a low level language and is suitable for making any application software as a high level language

Is Palm OS is an example of open source software?

GIMP, LibreOffice, Google Chrome, Firefox or Apache Web Server are open source software.

You can find large list on enterprise open source software list or personnal open source software list.

What is the difference between program and programming as used in computer programming?

The difference between a program and programming is programming is the actual activity of writing computer code in any of the various computer languages available, the end result of which is a program. The program can then be ran by the computer and perform the task the programmer told it to do.

Distinguish between the concept assembler compiler and interpreter?

Compiler -- reads human-readable source code, produces machine-executable binary code. Examples are C, COBOL, Java, etc. Easiest for humans to program, but does not always produce the most efficient executables.

Interpreter -- Reads human-readable code, line at a time, and produces and executes machine instructions "on the fly". Example is good old BASIC. Good for testing, but is VERY slow.

Assembler -- Converts machine-manipulation coding directly into binary machine instructions. Produces the most efficient executables, but is the most difficult (for humans) to work with.

Best of all worlds (my opinion) is C on Unix, for speed, ease of use, program efficiency.

1 what is the main advantage of multiprogramming?

Multiprogramming is the rapid switching of the CPU between multiple processes in memory. It is done only when the currently running process requests I/O, or terminates. It was commonly used to keep the CPU busy while one or more processes are doing I/O. It is now mostly

superceded by multitasking, in which processes also lose the CPU when their time quantum expires.

Multiprogramming makes efficient use of the CPU by overlapping the demands for the CPU and its I/O devices from various users. It attempts to increase CPU utilization by always having something for the CPU to execute.

The prime reason for multiprogramming is to give the CPU something to do while waiting for I/O to complete. If there is no DMA, the CPU is fully occupied doing I/O, so there is nothing to be gained (at least in terms of CPU utilization) by multiprogramming.

What language can a computer always understand?

I have only a vague understanding of your question, but I'll take it as "why computers can understand language". :P.
- they don't
-they only seem to cause it was written in their program.

if it meant "what language computers understand",
-programming language.
-go search up wikipedia on this one.

What are the Features of a form based interface?

  • it has specified areas for the data. For example, boxes for input of coded material like the date or the sex of the customer, and areas to be filled in with textual information.
  • it has a cursor which moves to the next box to be filled in, sometimes the box is highlighted to make it clear to the operator where the data is to be inserted.
  • some of the boxes are more important than others and the cursor will not move on until some data has been supplied.
  • it checks that what has been input is sensible for that box before moving on to the text.

Give an example of pseudocode program?

Pseudocode is a non-specific programming language that is used to outline an algorithm's logic using plain-English terms and sentence structures, but often incorporating the grammar of well-known programming constructs such as loops and branches.

For example, the following pseudocode demonstrates a loop that prints the values from 1 to 10:

let number be 0

repeat while number is less than 10

increment number

print number

This is a simple example, however anyone familiar with at least one programming language can translate this pseudocode into their chosen language without too many problems. The point of pseudocode is to reduce complex algorithms to their simplest form, without being overly-specific with regards an actual programming language. That is, the focus is purely upon the algorithm itself, rather than the idiosyncrasies of specific coding methods.

Pseudocode is not a programming language, per se, so there are no grammar rules regarding syntax or sentence structure. However, each line of code should be short and to the point (not overly-wordy), clearly conveying the point of the code. Whitespace and indentation should be used wherever necessary to convey the separation of code blocks (as shown in the example), or to break down complex lines into bite-size chunks that clearly show the logic.

Information system input devices?

Input devices transfer data to an information system and the system processes the data. There are manual input devices and direct data entry devices that are used. Manual devices include keyboards and scanners. Direct data entry devices include smart cards and optical mark recognition.

How polymorphism can be achieved by means of virtual functions in C plus plus?

Virtual functions of a class are functions (methods) that can be redefined in a child class and, through polymorphism, the correct function will be invoked depending on the type of the class involved. Virtual functions are declared with the virtual keyword... class myclass {

... virtual int myfunction(...);

... etc.

} When a class contains at least one virtual function, a static virtual table (vtable) is implemented behind the scenes by the compiler. This table is used to point to the correct implementation for that type of class at run-time. Abstract base classes are a special form of class, where they must be derived. They often declare virtual functions which is the defined interface, but through the keyword "= 0" enforce the requirement that the class be derived, i.e. that the class can not be instantiated directly... class myclass {

... virtual int myfunction(...) = 0;

... etc.

} class mysubclass : public myclass {

... virtual int myfunction(...);

... etc.

}

What do you mean by prototype of function?

Building a prototype allows the designer to explore unforeseen problem areas before building the finished product. Prototypes can also be used for testing to see how a device will operate in real-world conditions as opposed to computer projections, and to determine production cost and propose a budget.

Write a program to implement stack in openGL?

Module Module1

Sub Main()

myQuequeue()

myStack()

Console.ReadLine()

End Sub

Private Sub myQuequeue()

Dim theQ As New Queue

Dim dStr, frmstrArr() As String

Dim i As Integer

frmstrArr = FillArr()

For i = 0 To 25

theQ.Enqueue(frmstrArr(i) + " queue")

Next

For i = 0 To 25

dStr = theQ.Dequeue()

Console.WriteLine(dStr)

Next

End Sub

Private Sub myStack()

Dim theStack As New Stack

Dim dStr, fStr() As String

Dim i As Integer

fStr = FillArr()

For i = 0 To 25

theStack.Push(fStr(i) + " stack")

Next

For i = 0 To 25

dStr = theStack.Pop()

Console.WriteLine(dStr)

Next

End Sub

Private Function FillArr()

Dim strArr(25) As String

strArr = New String() {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}

Return strArr

End Function

end module

Concept of object oriented programming?

Java is an object oriented programming language. The main concepts used in Java are:

Class

Defines the abstract characteristics of a thing (object), including the thing's characteristics (its attributes, fields or properties) and the thing's behaviors (the things it can do, or methods, operations or features). One might say that a class is a blueprint or factory that describes the nature of something. For example, the class Dog would consist of traits shared by all dogs, such as breed and fur color (characteristics), and the ability to bark and sit (behaviors). Classes provide modularity and structure in an object-oriented computer program. A class should typically be recognizable to a non-programmer familiar with the problem domain, meaning that the characteristics of the class should make sense in context. Also, the code for a class should be relatively self-contained (generally using encapsulation). Collectively, the properties and methods defined by a class are called members.

Object

A pattern (exemplar) of a class. The class of Dog defines all possible dogs by listing the characteristics and behaviors they can have; the object Lassie is one particular dog, with particular versions of the characteristics. A Dog has fur; Lassie has brown-and-white fur.

Instance

One can have an instance of a class or a particular object. The instance is the actual object created at runtime. In programmer jargon, the Lassie object is an instance of the Dog class. The set of values of the attributes of a particular object is called its state. The object consists of state and the behaviour that's defined in the object's class.

Method

An object's abilities. In language, methods (sometimes referred to as "functions") are verbs. Lassie, being a Dog, has the ability to bark. So bark() is one of Lassie's methods. She may have other methods as well, for example sit() or eat() or walk() or save_timmy(). Within the program, using a method usually affects only one particular object; all Dogs can bark, but you need only one particular dog to do the barking.

Message passing

"The process by which an object sends data to another object or asks the other object to invoke a method." Also known to some programming languages as interfacing. For example, the object called Breeder may tell the Lassie object to sit by passing a "sit" message which invokes Lassie's "sit" method. The syntax varies between languages, for example: [Lassie sit] in Objective-C. In Java, code-level message passing corresponds to "method calling". Some dynamic languages use double-dispatch or multi-dispatch to find and pass messages.

Inheritance

"Subclasses" are more specialized versions of a class, which inherit attributes and behaviors from their parent classes, and can introduce their own.

For example, the class Dog might have sub-classes called Collie, Chihuahua, and GoldenRetriever. In this case, Lassie would be an instance of the Collie subclass. Suppose the Dog class defines a method called bark() and a property called furColor. Each of its sub-classes (Collie, Chihuahua, and GoldenRetriever) will inherit these members, meaning that the programmer only needs to write the code for them once.

Each subclass can alter its inherited traits. For example, the Collie class might specify that the default furColor for a collie is brown-and-white. The Chihuahua subclass might specify that the bark() method produces a high pitch by default. Subclasses can also add new members. The Chihuahua subclass could add a method called tremble(). So an individual chihuahua instance would use a high-pitched bark() from the Chihuahua subclass, which in turn inherited the usual bark() from Dog. The chihuahua object would also have the tremble() method, but Lassie would not, because she is a Collie, not a Chihuahua. In fact, inheritance is an "a... is a" relationship between classes, while instantiation is an "is a" relationship between an object and a class: a Collie is a Dog ("a... is a"), but Lassie is a Collie ("is a"). Thus, the object named Lassie has the methods from both classes Collie and Dog.

Multiple inheritance is inheritance from more than one ancestor class, neither of these ancestors being an ancestor of the other. For example, independent classes could define Dogs and Cats, and a Chimera object could be created from these two which inherits all the (multiple) behavior of cats and dogs. This is not always supported, as it can be hard both to implement and to use well.

Abstraction

Abstraction is simplifying complex reality by modelling classes appropriate to the problem, and working at the most appropriate level of inheritance for a given aspect of the problem.

For example, Lassie the Dog may be treated as a Dog much of the time, a Collie when necessary to access Collie-specific attributes or behaviors, and as an Animal (perhaps the parent class of Dog) when counting Timmy's pets.

Abstraction is also achieved through Composition. For example, a class Car would be made up of an Engine, Gearbox, Steering objects, and many more components. To build the Car class, one does not need to know how the different components work internally, but only how to interface with them, i.e., send messages to them, receive messages from them, and perhaps make the different objects composing the class interact with each other.

Encapsulation

Encapsulation conceals the functional details of a class from objects that send messages to it.

For example, the Dog class has a bark() method. The code for the bark() method defines exactly how a bark happens (e.g., by inhale() and then exhale(), at a particular pitch and volume). Timmy, Lassie's friend, however, does not need to know exactly how she barks. Encapsulation is achieved by specifying which classes may use the members of an object. The result is that each object exposes to any class a certain interface - those members accessible to that class. The reason for encapsulation is to prevent clients of an interface from depending on those parts of the implementation that are likely to change in future, thereby allowing those changes to be made more easily, that is, without changes to clients. For example, an interface can ensure that puppies can only be added to an object of the class Dog by code in that class. Members are often specified as public, protected or private, determining whether they are available to all classes, sub-classes or only the defining class. Some languages go further: Java uses the default access modifier to restrict access also to classes in the same package, C# and VB.NET reserve some members to classes in the same assembly using keywords internal (C#) or Friend (VB.NET), and Eiffel and C++ allow one to specify which classes may access any member.

Polymorphism

Polymorphism allows the programmer to treat derived class members just like their parent class' members. More precisely, Polymorphism in object-oriented programming is the ability of objects belonging to different data types to respond to method calls of methods of the same name, each one according to an appropriate type-specific behavior. One method, or an operator such as +, -, or *, can be abstractly applied in many different situations. If a Dog is commanded to speak(), this may elicit a bark(). However, if a Pig is commanded to speak(), this may elicit an oink(). They both inherit speak() from Animal, but their derived class methods override the methods of the parent class; this is Overriding Polymorphism. Overloading Polymorphism is the use of one method signature, or one operator such as "+", to perform several different functions depending on the implementation. The "+" operator, for example, may be used to perform integer addition, float addition, list concatenation, or string concatenation. Any two subclasses of Number, such as Integer and Double, are expected to add together properly in an OOP language. The language must therefore overload the addition operator, "+", to work this way. This helps improve code readability. How this is implemented varies from language to language, but most OOP languages support at least some level of overloading polymorphism. Many OOP languages also support Parametric Polymorphism, where code is written without mention of any specific type and thus can be used transparently with any number of new types. Pointers are an example of a simple polymorphic routine that can be used with many different types of objects.

Decoupling

Decoupling allows for the separation of object interactions from classes and inheritance into distinct layers of abstraction. A common use of decoupling is to polymorphically decouple the encapsulation, which is the practice of using reusable code to prevent discrete code modules from interacting with each other. However, in practice decoupling often involves trade-offs with regard to which patterns of change to favor. The science of measuring these trade-offs in respect to actual change in an objective way is still in its infancy.

Note: Not all of the above concepts are to be found in all object-oriented programming languages, and so object-oriented programming that uses classes is called sometimes class-based programming. In particular, prototype-based programming does not typically use classes. As a result, a significantly different yet analogous terminology is used to define the concepts of object and instance.

What is difference between assembler and linker?

There is no definite term "assembler" in compilation process. It is more like "compiler" and "linker".

Assembler usually refers to a compiler of machine language: http://en.wikipedia.org/wiki/Assembly_language

So you probably mean difference between compiler and linker?

Lets say you have a 3 module program, and it uses a 3rd party library, then the compiler will just compile each of your modules (separately) into binary pieces, which have "unclosed" references to abovementioned library and other 2 modules. After u have 3 binary pieces comes in "linker" it attaches those "unclosed" (or unlinked) links to other modules and library, therefore giving you working program file (.exe file for example).

Really hard to say that without a schema or something like that:) Hope this answer helped you.

What are the different types of register circuits?

There are two type of register in electronics domain one is shift resister and second is register.

shift register are used for shifting the data from left to right or right to left.

it has four types

SISO-serial in serial out

SIPO- parallel out

PISO-parallel in serial out

PISO- parallel out.

and register are simply used for storing the digital data.

What do you mean by object oriented language?

An object oriented language uses concepts of classes, objects, and methods.

Rather than just having plain functions to store procedural instructions, a program written in an object-oriented language like Java has classes that are basically blueprints to create objects. Objects have their own little functions called methods. Objects can have their own variables too.

Of course, there are much more complex concepts in object-oriented programming such as inheritance and polymorphism.

Was binary stands for binary digits?

No, binary is a number system.

A binary digit is called a bit.

Which algorithm has some average worst case and best case time?

All algorithms have a best, worst and average case. Algorithms that always perform in constant time have a best, worst and average of O(1).

What is asp?

ASP means, Active Server Pages. An Active Server Page is a web page that includes program code that is processed on a Microsoft web server before the page is sent to the user. The code is typically used to access data from a database and that data is then built into the returned web page "on the fly". ASP was developed by Microsoft and is a feature of Microsoft's web server software, but the dynamically generated pages can be viewed by almost any browser. Because at run-time the code is translated to html+JavaScript code

Write the algorithm of quick sorting?

1- set pass =1

2- repeat step 3 varying j from 0 to n-1-pass

3- if the element at index j is >than the element at index j+1 swap the two element

4- increment pass by 1

5-if pass is <=n-1 go to step 2

Why do we need type casting in programming?

Becuase, sometimes data is in a form that is unrecognizable to the program. Example:

int a = 2;

int b = 3;

double c = a / b;

We cast c as a double. if it was not, then the data would not have a decimal value.