answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

Defference between c plus plus and c?

these are difference in between c and c++: a) C is a SPL and C++ is a OOP. b) C has not concept of object but C++ has this feature. c) C has not 'class' name data type but C++ has.

What commands clear the computers memory?

When you turn it off, all memory is lost. You usually end up with pseudo-random patters.

To actively clear all mem would require a machine language program ... which would be wiped in the process.

Advantages of language processing system in which compiler produces assembly language?

Assembly language is easier to produce as output of compiler and it is easier to debug assembly language.

How do you pass an array to a function in C programming?

The declaration of an array of 3 int pointers will be:

int *p[3];

The declaration of a function that receive an array of int pointers will be:

int my_func(int **p);

or

int my_func(int *p[]);

and you can pass it to other function simply by passing p.

Difference between semantic error and logical errors?

Syntax Error: error due to missing colon, semicolon, parenthesis, etc. Syntax is the way in which we construct sentences by following principles and rules.

Example: In C++, it would be a syntax error to say

int x = "five";

This will not compile because it does not follow the syntax of the language and does not make any sense to the compiler.

Semantic Error: it is a logical error. it is due to wrong logical statements. Semantics is the interpretations of and meanings derived from the sentence transmission and understanding of the message. Semantics errors are Logical, while Syntax errors are code errors.

Example: A semantic error would compile, but be incorrect logically:

const int pi = 12345;

Your program will likely compile and run without error but your results will be incorrect. (Note that these types of errors are usually much harder to debug)

What is corrupt file?

File can be corrupt due to several reasons, some of then are given bellow:

  1. Human Error: Auto shutdown
  2. Natural Disaster: Flood, Fire, and many more.
  3. Virus Attack
  4. Hardware Failure
  5. System Crash/Hard Drive Crash
  6. Power Failure

How many scripting languages are there?

Three type of languages

High level

Mid level

Low level

What is Array in Programming C?

Arrays allow similar types of data to be stored within a contiguous block of memory such that every data element is accessible in constant time, regardless of its physical location within the array. This is achieved through simple pointer arithmetic treating each element as a memory offset from the start of the array. Since every element is the same length (in bytes), locating any element is simply a matter of calculating its offset from its index. Indices are zero-based thus the third element can be found at index 2. The memory offset for that element is therefore the product of the element size and 2. However, C permits indices to be specified directly, while the pointer arithmetic is done in the background. Thus array_name[2] automatically returns a reference to the third element.

Arrays with large and complex variable length data elements need to store those elements separately from the array, usually non-contiguously. This is achieved by using a pointer array. Pointer arrays are particularly useful when sorting extremely large data lists as it is much easier and more efficient to implement a sorting algorithm with an array than it is with a linked list, particularly when constant-time random-access is essential to the algorithm. The time and effort in building the array is generally more than compensated for by the efficiency of the algorithm.

Arrays can also be divided and subdivided to better model the data they represent. For instance, a chessboard might be implemented as a one-dimensional array of 64 elements, however it makes more sense to model the chessboard in a two-dimensional array of 8x8 elements. Although the array is still allocated contiguously and can be thought of as being 8 rows and 8 columns, it's actually better to think of this two-dimensional array as being a one-dimensional array of 8 elements, where each element is another one-dimensional array of 8 elements.

By thinking this way it makes it possible to allocate extremely large arrays in non-contiguous memory (as completely separate one-dimensional arrays) and also makes comprehension of a four-dimensional array in a three-dimensional world that much easier (unless you actually want to model time and space of course).

A four-dimensional array can be thought of in a variety of ways: as being a one dimensional array of three-dimensional arrays, or as a two-dimensional array of two-dimensional arrays, or as a three-dimensional array of one-dimensional arrays, or even as a one-dimensional array of one-dimensional arrays of one-dimensional arrays of one-dimensional arrays. Whichever method you use to imagine your array is immaterial, so long as it makes sense to you that's all that really matters.

What are examples of data base software?

The database is a collection of data which we can perform operations, a structured set of data held in a computer, especially one that is accessible in various ways.

A simple example for a database would be the record of all employees of CNN international on their payroll and storing data. Mr Gulfam Haidar used this

What is a recursive function?

A recursive function is one that calls upon itself until a given result in the original call is met.

Take a look at this example.

Program Recursion;

Uses

crt;

Var

number:longint;

Function Factorial(number:longint):longint;

Begin

if number > 0 then

factorial:=number*factorial(number-1)

else

factorial:=1;

End;

Begin

clrscr;

readln(number);

writeln(factorial(number));

readln;

End.

Note how the function factorial calls itself.

How many different binary trees can be made from three nodes?

As far as i Know, just one.

Do you know any formula to calculate how many binary search trees are possible?

--

answer:

(2n C n) / (n+1) = ( factorial (2n) / factorial (n) * factorial (2n - n) ) / ( n + 1 )

where 'n' is number of element (integer/string)

like:

N Number of BST

1 1

2 2

3 5

4 14

5 42

6 132

and so on

Why do we study programming languages?

You really don't have to, the vast majority of computer users will never need to know any. Just like the vast majority of car drivers don't need to study auto mechanics. People that will never use a computer certainly have no need. However if you want to program computers, either for your own casual entertainment or for a job, that's why!

Why is PHP considered a scripting language and not a programming language?

PHP is a programming language, just like Perl, Python, JavaScript, Basic and many other interpreted language.

Note: the PHP interpreter can be integrated into the webserver, or run standalone.

How does information become data?

Raw data becomes information once it is organized and sorted. Raw data that is collected, is useless until it becomes information.

Disadvantages of circular link list as compared to singly link list?

As compared with doubly-linked lists, one disadvantage is that singly-linked lists can only be efficiently traversed in one direction. Finding the (n - 1)th element, given only a pointer to the nth, requires scanning the list from the first element up to the (n - 1)th. Thus (if memory is too limited to permit tricks such as creating a reversed list) to iterate over the entire list in reverse order would require n + (n - 1) + ... + 1 = n(n + 1)/2 link traversals, which grows quadratically with n. Obviously for a doubly-linked list the time merely grows linearly with n.

A down-side of all linked lists versus arrays is that random access can be inefficient; the time taken to find an element with a randomly chosen index grows in direct proportion to the list's length (since we must scan from one of the ends). In contrast, an array allows us to index directly to the elements with simple pointer arithmetic, in a time independent of the array's size - at least in an idealised environment.

What is the encoding technique called used to store negative numbers in the comouter's memory?

Negative integers are typically encoded using two's complement notation. That is, to convert the sign of any given integer, the bits are flipped (as per ones' complement) and 1 is added. Thus to convert the value +1 to -1 using 8-bit notation:

00000001 = 11111110 + 1 = 11111111

And reversing the process (-1 to +1):

11111111 = 00000000 + 1 = 00000001

In hexadecimal notation, the value 0x80 is the largest negative integer (-128) and 0x7F is the largest positive integer (+127). That is, 10000000 and 01111111 respectively.

Note that ones' complement was used in the past and while some systems still use it they are few and far between today. One of the problems with ones' complement is that +0 and -0 (00000000 and 11111111 respectively) would be treated as being two separate values, when the value 0 is neither positive nor negative. In twos complement, flipping the sign of zero becomes:

00000000 = 11111111 + 1 = 00000000

Note that the actual value is 100000000, but the most-significant bit (the overflow) is ignored because there can only be 8-bits in an 8-bit value. The same is true of 16-bit values, 24-bit values, etc. When all bits are filled with 1s, adding 1 wraps the value back to 0 again.

What is bare metal coding?

Bare metal coding a.k.a. coding or programming "on the metal" refers to writing computer programs in machine language, the only set of instructions that a CPU understands. Most would also include Assembly language in this category, as the resulting code runs natively (doesn't need to be compiled). All other computer languages must be translated by a compiler or interpreter into this native machine language.

What are the applications of matrices?

we can measure the expansion of the world by matrices cause in magnetic fields vectors can be streched up to a certain limit which are the eigen values.

Delphi is named after what goddess?

The Delphi programming language was named after the Oracle of Delphi, the common name for the Pythia, the priestess of the Temple of Apollo at Delphi in Greece. The Oracle database was a popular DBMS and, given that Delphi is based upon the Pascal programming language which focuses on database development, this tied in nicely with the phrase; "If you want to talk to the Oracle, go to Delphi."

Which amendment to the constitution is named after Susan B. Anthony?

okay i figured it out...its the 19th amandment! which gave women the right to vote. the 19th amendment is also known as the susan b Anthony amendment! thanks. you can Google the question and scroll down a little bit and it will tell you the same answer if you want to check and be sure

List four things a process control block holds?

A Process Control Block is a data structure in the operating system kernel containing the information needed to manage a particular process. In general a PCB will include:

  1. PID
  2. Process state ( Ready, Stop, etc. )
  3. Priority
  4. Parent ID
  5. Owner or user ID.
  6. Register values for the process including the program counter and stack pointer values for the process.
  7. The address space for the process.
  8. Process accounting information, such as when the process was last run, how much CPU time it has accumulated, etc.
  9. Pointer to the next PCB i.e. pointer to the PCB of the next process to run
  10. I/O Information (i.e. I/O devices allocated to this process, list of opened files, etc)

What is the best programming language to learn for jobs?

Best in what way? Best for the computer to learn? Well, that is determined by two things...the algorithm that the computer processor(s) run through to achieve the "machine learning", and the speed/efficiency of that algorithm - since it could be an algorithm that will work but perhaps will take so much time to arrive at a good result that it is ineffective in a practical sense.

Now, if you want to ask instead what is the best computer language in which to program algorithms...it is a controversial subject, but overall I would say programming it in a language that is translated well into the machine language which will be running the algorithm, since it must be the best that it can be -- for speed and efficiency. Then, the computer processor(s) speed is/are not hampered by the inefficiency of the choice of code generator or compiler/intrepreter (i.e., in general, the programming language).

However, I also suspect that you are asking from a personal point of view, namely, which language should you learn if you wanted to get into this machine learning field...I think majority of people working in the field like Prolog, Lisp, C++, and Java. Also, there are some people programming in Natural Language Programming (NLP) parsing and lexical analysis that prefer computer languages devoted specifically to NLP.

NLP and Machine Learning algorithms are often working hand in hand to sift through human language texts of all kinds to glean and summarize information and find relevant correlations that exist between all of the ideas and stories in those texts - some factual info, some opinions. Businesses like this stuff for data mining and finding patterns amongst people's likes and dislikes so that they can market to those preferences.

Also, many people like to discover correlations, for instance, that say when certain words are used in a financial article, the chances are that these certain types of stocks will rise in price. Thus data mining is a large reason for the popularity of machine learning.

NLP has been around for many years and is the effort behind what many people have sought -- to build a computer helper that they can talk with in a natural way - so much easier than all that typing and thinking of how to pose the question just so.

It is the next step in the evolution of an internet search engine -- one that learns the best answers and filters out all the extra stuff and does not present the "irrelevant".

My guess is that the programming language choice for machine learning algorithms will become less important than the design of the machine learning algorithms themselves. As time goes forward, the "programming" is being done with visual tools and automatic code generators, and implementing a design of a new machine learning learning algorithm is done with those high level tools where the designers don't necessarily know how it looks in the programming language or in the machine language.

An argument can be made that the "programmers" should know the efficiency of their designs of the machine learning algorithms on that hardware - but that is usually left to the people who are specifically designing the code generators - which is something far removed from the fun of designing the machine learning algorithms. Specialization is the nature of these fields. So, some designers will arrive on the scene that don't know anything about programming languages, they just know the algorithms of the specific domain and are constantly improving them using the Algorithm Studio software.