answersLogoWhite

0

📱

Computer Science

Computer Science is the systematic study of algorithmic processes that describe and transform information. It includes the theoretical foundations of information and computation and the practical techniques of applying those foundations to computer systems. Among the many subfields of Computer Science are computer graphics, computer programming, computational complexity theory, and human-computer interaction. Questions about Computer Science, terms such as algorithms and proofs, and methodologies are encouraged in this category.

1,839 Questions

Progarm to delete previous node in linked list?

struct LinkedListNode

{

void* data;

LinkedListNode* next;

};

LinkedListNode* head;

LinkedListNode* tmp;

while (head)

{

tmp head->next;

free(head);

head tmp;

}

Full form of dim in visual basic language?

DIM stands for declaration in memory. the words DIM is used to declare a variable.

Yes Correct, I used to declare variable.

I think it means Dimension, Dimension Of the memory location

The original Basic language did not require or have a type definition. All variables were numeric with no distinction between integer and real/float. Assigning space for a variable was easy, they were all the same type and size.

Some Basic implementations, using variable name modification, later added character variables by a dollar sign appended (varname$) and an integer type with a percent sign (varname%) leaving the unsuffixed version as it originally was. You were allowed to have all three versions of a name in play at the same time so Basic still had no type declarations.

For an array, you needed to tell Basic how much space to allocate for the array. Some of the more used languages at that time (e.g. fortran) used a"Dimension" keyword for this and Basic similarly used a shorter DIM statement.

Being that the designers of VB were implementing a version of Basic and they did need a type declaration, I would guess they decided to use the closest thing available: A DIM statement.

What is message passing explain the advantages of message passing?

message passing is the way of exchanging information between systems or individuals,at d same time.advantage is that we can interact by getting all the necessary details

What are the disadvantage of conventional programming language?

ali asghari:

It shouldn't be a problem, as long as:

1) The features are well-designed, e.g. having one sort function that takes a few options, rather than many sort functions that do slightly different things

2) The features are namespaced - e.g. mathematical functions are in a Maths module or object, that way user function and variable names are less likely to collide with language base features, and be broken by language version increments

3) The features are properly documented in an organised way - there's no point in offering a facility if the programmer doesn't know it's there or the specs give no clue on how it's supposed to be used

4) The features don't duplicate one another - e.g. different names for the same function, different possible syntaxes for the same meaning, etc. which makes code harder to read for programmers familiar with the "other" syntax

5) The features aren't out of scope for the language (e.g. there's no point in features for 3D graphics acceleration in a language designed for web servers), as this will increase memory requirements, and thin out performance efforts.

So, the disadvantages would be if one of these pitfalls is encountered, and the potential problems caused

What are the applications of Differential equations in the field of computer programming?

There are several applications of differential equations...

To begin with, there is the typical distance with respect to time (e.g. finding the rate of change between two cars after four hours if they start at a point and move in a 90 degree angle from each other). The differential equation is also used in physics with Newton's Second Law of Motion and the Law of Cooling. It can also be used in Hooke's Law for modeling the motion of a spring or in representing models for population growth and money flow/circulation. There are many other applications and there are many equations out there that can be used to set up and solve day-to-day problems.

Experience: Calculus 2 student

How exception handling mechanism can be used for debugging a program in java?

Trapping and handling of runtime errors is one of the most crucial taska ahead of any programmer. AS A DEVELOPER, YOU SOMETIMES SEEM TO SPEND MORE TIME CHECKING FOR ERRORS AND HANDLING THEM THEN YOU DO ON THE CORE LOGIC OF THE ACTUAL PROGRAM.

Explain the difference between public and protected access specifier?

A private variable is only accessible in the class where it was declared

A protected variable is accessible to sub classes and classes in the same package as where they were declared

Hexa to octal?

The best way is to first convert hexadecimal to binary and then to octal.

For example the hexadcimal number B4EA is in binary:

B 4 E A

1011 0100 1110 1010

Thus B4EA (hexadecimal) = 1011010011101010 (binary)

We add leading zeros to the binary number in order to be able to divide the number in sets of 3 digits. Then we convert easy to octal as follows:

001 011 010 011 101 010

1 3 2 3 5 2

Therefore 1011010011101010 (binary) = 132352 (octal)

and from here you have your result:

B4EA (hexadecimal) = 132352 (octal)

What are the uses of macros?

With macros, you can perform long or boring tasks just by a single click or keystroke combination. Also, you would not need to repeat the same action over and over again.

Can borland compiler perform the graphics in c?

No. But programs compiled with Borland compilers might be able, platform-dependent.

How function can be nested in c?

A function can call other functions (or itself), but a function-definition cannot be nested in another function-definition:

int main (void)

{

void wont_compile (void) { puts ("Won't compile"); }

wont_compile ();

return 0;

}

Which header file is used to develop a function that can accept variable number of arguments?

.If you want to accept variable no of arguments then you have to include which of the following header files

a) Vararg.h b) stdarg.h c) stdlib.h d) stdioh

What is the difference between gets and puts?

Direction:

gets: from standard input to memory

puts: from memory to standard input

note: 'gets' is unsafe, use 'fgets' instead

What happens when a program is compiled?

when you compile your program , it is sequentially checking your coding and check whether there is an error. thats the simple thing happening. if there is no error, then it will create an executable file for your coding which is run when you ask to run the program after compiling. if your coding have an error, then you have to correct those errors. REMEMBER that it is compulsory to compile the program after you correct the errors. otherwise, it will not make an executable file with your corrections.

What language does the computer use and understand?

Dual system 1 and 0

It can also depend what you mean by computer, and how deep you want to go. You can make a "Computer" with wood and strings, as proven by the Jaquard Loom. Hardware is key, no matter how basic. So, in theory (i guess) the Basic Language would be how the computer...works! If you want to go to the very basics.

What is worst case complexity of quick sort?

Selection sort has no end conditions built in, so it will always compare every element with every other element.

This gives it a best-, worst-, and average-case complexity of O(n2).

How can insert a data into file in c?

You insert data into a file by copying the file to a temporary file up to the point of insertion, then copying the data to be inserted, then copying the balance of the original file. After closing the temporary file you delete the original file and rename the temporary file back to the original file's name.

1 What are the three basic functional blocks of a computer?

Binary bits. This is 0s and 1s. Everything else is built up from these 0s and 1s to make more human-understandable language.

0s and 1s are used because it is very easy to make clear, definable electrical signals for 0 and 1. It is simply "on" and "off".

What is the worst case and best case of bubble sort?

There is no worst case for merge sort. Each sort takes the same amount of steps, so the worst case is equal to the average case and best case. In each case it has a complexity of O( N * log(N) ).

What is recursive algorithm?

Algorithm can be defined as an interpretable, finite set of instructions for dealing with contigencies and accompanying task that has recognizable end-points for given inputs. It is a tool for solving a well computational problem. A recursive algorithm is one which calls itself.

Is it true or false that a dynamically linked list can be accessed both sequentially and randomly?

No. Linked lists require traversal, and are therefore accessed sequentially. For random access you need an array. An array of pointers to the data in your list would do, but you will incur an overhead in creating the array on top of the list.

What is the function of windows in GUI?

Where the user interacts with a program. Information shows in these windows and multiple windows can be started at the same time. Every application has to be opening in a window.

What is the Space complexity of insertion sort algorithm?

Insertion sort splits a data sequence in two; a sorted portion at the beginning of the sequence followed by an unsorted sequence. Initially, the sorted sequence has just one element because a sequence of 1 can always be regarded as being sorted. We then take the first unsorted element and insert it in its proper place within the sorted sequence. This is achieved by removing it from the sequence (creating a gap in the sequence). We then look at the element to the left of the gap. If it is larger than the element we removed we move the element one position to the right, effectively moving the gap one position to the left. We repeat the process until the element to the left of the gap is smaller or equal to the removed element, or we reach the start of the sequence. We then insert the removed element into the gap, increasing the sorted set by 1 element and reducing the unsorted set by 1 element. We repeat the process until the unsorted set is empty.

The best case for insertion sort is O(n) time because we need to make at least one complete pass over the set. The best case occurs when the set is already sorted and therefore incurs no moves, but we still have to make a single pass over the set to confirm this. In reality, the complexity is O(n-1) because the first element is known to be sorted, however we can ignore minor differences like -1. Moreover, we have to move n-1 elements out of the set and back in again in the same place, but these two operations occur whether an element moves or not, so we can discount it.

The worst case occurs when the set is in reverse order. However, if we count the number of moves in the worst case we find there are k moves on the kth pass, where k<n. Thus for a set of 10 elements, there are 1+2+3+4+5+6+7+8+9 moves in the worst case, which is 45 (a triangular number). Unfortunately, there is no simple notation for triangular numbers, but time complexities are merely intended to give us an indication of performance. We can clearly see that to move n elements we need to make n passes, thus the worst case time-complexity can be denoted as O(n*n).