answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

What is a program written in high level language called?

the program written in high level language is called "source program"

How class accomplish data hiding?

Data hiding is one of the important aspects of a class. Data hiding means to hide the members of the class and providing the access to only some of them. we can make the members of the class private or public. in private,the outside world cannot access those members which been made private.and rest we can make public.only the public members are accessed by the out side world and all the private members can be accessed using only the public members.in this way a class provides security to its data members.

What are the characteristics of an algorithm. Describe with an example?

An algorithm is a stepwise sequence of operations that can be performed to solve a problem. The operations are expected to be 'simple', so they can be performed mechanically.

A simple example algorithm is "how to find the largest number in a list of numbers":
- look at the first number and write it down as the largest-so-far
- for each remaining number in the list:
- - replace largest-so-far with this number if this number is larger
- when you have compared all the numbers, largest-so-far is the largest number in the list

A less trivial algorithm is the one people learn in school for multiplying multi-digit numbers, called "long multiplication" or "grade-school multiplication". It becomes rather long if you write down all the steps (as you would need to for an algorithmic description), but it involves multiplying each digit in the first number with each digit in the second number and summing the partial results.
Here the simple operation is multiplying two single digits, which you are expected to know how to do, and by using the algorithm you can extend the knowledge of how to multiply single digits to multiply numbers with any number of digits.

See related links.

Explain the difference multimedia and interactive multimedia?

Multimedia is defined as the combination of different media elements such as text, pictures, sound and movie etc...

In interactive multimedia, the user or operator is able to interact with the computer directly. (Eg: computer games, interactive websites, multimedia presentations or interactive Cd's etc..)

Is machine language is also called a assembly language?

Computers only understand machine code. Low-level Assembler language and all high-level languages must be assembled or compiled to machine code in order to execute. However, the computer itself can be programmed (with a machine-code program) to generate the required machine code from either a low-level or high-level input. Low-level Assembler is an almost one-to-one translation of symbols and mnemonics to machine code whereas high-level languages often compile to object code which is then linked to produce machine code.

Interpreted high-level languages are not compiled to machine code but are interpreted by another program, an interpreter, which translates each line of high-level code into the required machine code at runtime. Java, for instance, compiles to byte code suitable for the Java virtual machine. The JVM is a machine code program that interprets the byte code to produce machine-specific machine code. As a result of this interpretation, Java programs are much slower than machine-coded implementations of the same program.

Write a C program to check a string is a palindrome or not?

cls

input "enter a string=";s$

l=len(s$)

for i = l to 1 step-1

c$=mid$(s$,i,l)

next i

r$=c$+r$

if r$=c$ then

print "no. is palindrome"

else

print "no. is not palindrome"

endif

end

Who invented a calculating machine?

The very first calculating "machine" was human hands and fingers.

The abacus was next in about 300 BC.

Can a thread create a process?

No, a thread can't create aprocess, because the environment of the thread is a part of a process which created this thread.

Which book is best for software programming?

There is no single book that is best for programming. There are many programming languages and each will have one or more recommended books associated with it. For instance, C++ programmers will typically own "The C++ Programming Language" and "Programming: Principles and Practice Using C++", amongst many others. Programmers will also own text books related to more specific type of programming, such as multimedia/games programming, financial programming, scientific programming, and so on. In short, you cannot rely on just one book to teach you everything you need to know.

Where does the main function starts and end in c program?

The entry point of a C program is the main function.

The function signature might be like one of these:

1. int main (void)

2. int main (int argc, char *argv[])

Definition of memory and its types?

Memory refers to the physical devices used to store programs (sequences of instructions) or data (e.g. program state information) on a temporary or permanent basis for use in a computer or other digital electronic device. Computer Memory is two types as Primary Memory and Secondary Memory at the base of uses. The term primary memory is used for the information in physical systems which function at high-speed (i.e. RAM), as a distinction from secondary memory, which are physical devices for program and data storage which are slow to access but offer higher memory capacity. When data of Primary Memory stored on secondary memory is called "virtual memory".

Primary Memory

The term "memory" is often (but not always) associated with addressable semiconductor memory, i.e. integrated circuits consisting of silicon-based transistors and used as primary memory. Primary storage (or main memory or internal memory), often referred to simply as memory, is the only one directly accessible to the CPU. The CPU continuously reads instructions stored there and executes them as required. Any data actively operated on is also stored there in uniform manner. RAM used for primary storage is also volatile, i.e. they lose the information when not powered). Cash Memory is also a super fast then RAM and it working for only processor.

There are two main types of semiconductor memory: volatile and non-volatile.

Examples of non-volatile memory are flash memory (sometimes used as secondary, sometimes primary computer memory) and ROM/PROM/EPROM/EEPROM memory (used for firmware such as boot programs). Examples of volatile memory are primary memory (typically dynamic RAM, DRAM), and fast CPU cache memory (typically static RAM, SRAM, which is fast but energy-consuming and offer lower memory capacity per area unit than DRAM).

Secondary Memory

The term "storage" is often (but not always) used in separate computers of traditional secondary memory such as tape, magnetic disks and optical discs (CD-ROM and DVD-ROM). Secondary storage (also known as external memory or auxiliary storage), differs from primary storage in that it is not directly accessible by the CPU. The computer usually uses its input/output channels to access secondary storage and transfers the desired data using intermediate area in primary storage. Secondary storage does not lose the data when the device is powered down-it is non-volatile. Hard disk, CD and DVD drives are usually used as secondary storage. Some other examples of secondary storage technologies are: flash memory (e.g. USB flash drives or keys), floppy disks, magnetic tape, paper tape, punched cards, standalone RAM disks, and Iomega Zip drives.

What is the use of namespace?

There are many situations when writing a computer program that requires one to make use of libraries provided by other people. Suppose that you have created a program to do matrix multiplication, and one of your functions inside this program is called multMatrix(a, b). Now suppose you are using a library provided by someone else (not necessarily for matrices), and quite by coincidence their library also contains a function called multMatrix(a, b) -- thus both of these functions have exactly the same signature. Which one should be used? Old-school programmers and librarians used to go through a lot of effort to try and establish function names that would be unique -- however, this did not always solve the problem. The use of name-spaces provides an adequate mechanism for avoiding these "name clashes". Functions (or methods) are now grouped into namespaces, and we are assured (to a certain point) that namespaces should be unique (for example if you use the name of the company you are working for as a namespace), now even if two functions have the same signature they should be located within different namespaces, allowing you to avoid name-clashes.

What is command line interface?

A CLI (command line interface) is a user interface to a computer's operating system or an application in which the user responds to a visual prompt by typing in a command on a specified line...

What are theApplications of stack in data structure?

1. Expression evaluation and syntax parsing

Calculators employing reverse Polish Notation use a stack structure to hold values. Expressions can be represented in prefix, post fix or infix notations. Conversion from one form of the expression to another form may be accomplished using a stack. Many compilers use a stack for parsing the syntax of expressions, program blocks etc. before translating into low level code. Most of the programming languages are context-free languages allowing them to be parsed with stack based machines.

2. Runtime memory management

A number of programming languages are stack oriented , meaning they define most basic operations (adding two numbers, printing a character) as taking their arguments from the stack, and placing any return values back on the stack. For example, Post Script has a return stack and an operand stack, and also has a graphics state stack and a dictionary stack.

3. Security

Some computing environments use stacks in ways that may make them vulnerable to security breaches and attacks. Programmers working in such environments must take special care to avoid the pitfalls of these implementations.

What language is used for robot programming?

A bot can be written in a server-side language like php, asp, etc.

How do you implement queue using singly linked list?

Queues are a first in first out structure (FIFO). This means all extractions occur at the head of the list and all insertions occur at the tail. This requires that you maintain pointers to the head and tail node to allow constant time insertion and extraction of nodes. The nodes themselves are singly linked, each pointing to the next node. The tail node always points to NULL until a new node is insert, which the tail points to. The new node then becomes the tail. When extracting a head node, its next node (which may be NULL if it is also the last node) becomes the new head of the list. If the head is NULL, the tail is also set to NULL.

What are the characteristics of the bubble sort algorithm?

Bubble sort is a stable, in-place sort with a best, worst and average case of O(n!) for n elements, thus making it highly inefficient and entirely unsuitable for sorting large amounts of data. For this reason bubblesort is often cited as an example of how not to write an algorithm.

The algorithm starts by accepting a zero-based array with n elements (0 to n-1). While n is greater than 1, the algorithm iterates an outer loop. On each iteration of the outer loop, an inner loop traverses from element index 1 to n-1. On each iteration of the inner loop, the element at the current index is compared with the element at the previous index. If they are out of order, the two elements are swapped. When the inner loop has finished, n is decremented. At this point element n is now its correct place and is ignored on the next iteration of the outer loop. When n is not greater than 1, all the elements are sorted and the outer loop terminates.

In other words, the algorithm locates the largest value in the range 0 to n-1 and places it at index n-1 (bubbling it up the list with each swap). After decrementing n, everything from element n up is sorted and everything below n is unsorted, thus creating two subarrays split at n. On each pass, the sorted subarray gains a new element and the unsorted subarray loses an element. When there is only one element in the unsorted subarray, the entire array is sorted.

The inefficiency of the algorithm is that it takes no account of elements at the end of the unsorted subarray that may already be in their correct position. The algorithm can be improved with the observation that the position of the last swap at the end of the inner loop means that everything from that point forwards is already sorted and don't need to be compared on the next pass. So rather than reducing the unsorted subarray by just one element, the subarray can be reduce by one or more elements. To achieve this we initialise a temporary variable with the value zero at the start of the outer loop, and whenever a swap occurs in the inner loop we assign the current index to the temporary variable. When the inner loop ends, the temporary variable indicates where the last swap occured and we can assign that value to n, which may reduce n by one or more elements on each pass. The only other change we need to make is that the outer loop now terminates when n is zero (the initial value of the temporary variable), which means no swaps occured on the last iteration of the inner loop, so everything must be sorted.

Even with this optimisation the worst case is still O(n!) if the list is completely reversed. However, for an already-sorted list the best case becomes O(n). Since these two extremes are isolated cases, the average case is somewhere in between, around O(n!/2), which is still highly inefficient and unsuitable for large amounts of data.

The following is an implemention of an optimal bubble sort in C++:

template<typename _Ty>

void bubble (std::vector<_Ty>& A)

{

unsigned size = A.size();

while (size)

{

unsigned temp = 0; // records last swap position

for (unsigned index=1; index<size; ++index)

{

if (A[index]<A[index-1])

{

std::swap (A[index],A[index-1]);

temp=index;

}

}

size = temp;

}

}

How do you get a computer in stick RPG?

In stick RPG complete, get 500 intelligence, click on the car next to your house and click the key. press c to get in.

Trending Questions
Where can you get a tasm assembler for Windows XP 32 bit? What is a sets of words and symbols and codes that enable humans to communicate with computers called? Write a c program to calculate factorial of a number using stack 2write a c program to generate a Fibonacci series using stack number of Fibonacci series is input by the user? How do you prevent data duplication? Which is better avi or flv? In Java you want to write a program that will prompt the user for a nonnegative value n the program will then do as follows in the discussion help please? What is the speed of USB 2.0? Which CPU is used in socket pga478b? What are the problem associated with dynamic memory allocation? How does scripting change a program? Which license prevails if code stating all rights reserved is put into a public GPL repository by the author or his later employer? What are the encryption algorithms used in ATM? What is a variable that has been declared and automatically initialized to zero.? What is the relationship between data structures and data storage? What is the difference between backtracking and dynamic programming? How in oops once a class is created it can be changed? What is the difference between c plus plus and perl language? What is the difference between an evaluation and an interpretation? If a process sleeps in algorithm iget when it finds the inode locked in the cache why must it start the loop? How many emails can you read with 200mb of data on your mobile?