answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

Difference between arraylist and array?

Terms from computer science:

You can imagine list like as string of pearls. They are connected with thread. If you got one you can go by thread to the other one next to it.

An array is like a meter. You know where you are so you can jump any amount of units around.

What is the best web language to learn?

There are serval web language to learn like PHP, WordPress, HTML, CSS, JavaScript, Laravel and much more. Learn this web language from the most popular and trusted platform Edusity. Find the best courses for your level and needs and expand your level up your career.

What is re-entrant code?

A reentrant function is a function which can be safely executed concurrently. This means it should allow a re-entry while it is running. The reentrant function should work only on the data given by the calling function. It must not have any static data also.

The term "reentrant" is used to refer to side wall profiles of the nozzles, wherein exit diameters of the nozzles are smaller than entrance diameters of the nozzles so that the side walls of the nozzles are not perpendicular to a plane defined by an exit surface of the nozzle member.

A Re entrant function is a function which guaranteed that which can be work well under multi threaded environment.

mean while function is access by one thread, another thread can call it... mean there is separate execution stack and handling for each...

So function should not contain any static or shared variable which can harm or disturb the execution..

mean it should not contain any static or shared variable....

Mean function which can be called by thread, while running from another thread safely...... and properly.... hope I have answered the correct thing....

And of course rem that re-entrant function is not same as recursive function.... totally different concept....

Do you need Python in your PC?

Python is just a programming software, you don't actually need it to run your computer. You can use Python if you'd like to program something, or learn how to program.

Why you need compiler?

You don't need if you don't want to develop computer programs. But if you want you should use it, for you can not make programs without a compiler.

Compiler is the programs that makes the computer program out of the code

What do hackers do to your computer?

ENDLESS harm! Couple months ago, a 15 year old boy hacked Miley Cyrus' Email Address to post nude pictures of her on the Internet! Luckly, he was arrested he/she could get in your personal file deleat every thing that you were and are working on and can chat with your friends and get them mad at you

Is C compiled or interpreted?

Assembler, COBOL, PL/I, C/C++ are all translated by running the source code through a compiler. This results in very efficient code that can be executed any number of times. The overhead for the translation is incurred just once, when the source is compiled; thereafter, it need only be loaded and executed.

Interpreted languages, in contrast, must be parsed, interpreted, and executed each time the program is run, thereby greatly adding to the cost of running the program. For this reason, interpreted programs are usually less efficient than compiled programs.

Some programming languages, such as REXX™ and Java™, can be either interpreted or compiled.

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.