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

How do you use prim's algorithm to find a spanning tree of a connected graph with no weight on its edges?

Prims Algorithm is used when the given graph is dense , whereas Kruskals is used when the given is sparse,we consider this because of their time complexities even though both of them perform the same function of finding minimum spanning tree.

ismailahmed syed

What are hot-swappable and hot-pluggable devices?

A device or series of devices referred to as "Hot plugging or hot swapping" means that they can be changed out without having to shut down the main system in order to do so.

Think of a USB thumb drive, how you can plug it in, use it, then disconnect it without ever having to reboot the computer. That is a good example of "Hot swap" technology. It is commonly used in RAID arrays or on device programming setups or disk duplicators.

C programming language bsc it notes?

different between defining value definition section and defining value declaration section

A merge algorithm which will merge two sorted lists into one sorted list?

You have two options here.

For the first you have to ask yourself, "Is my data continuously sorted by the list itself?" If you answered 'yes' then you can simply add all data from one list to the other and the combined list will be sorted.

If you answered 'no' to the above question, then it means you have two lists which are currently sorted, but which may not remain that way if new elements are added to them.

Let's look at some steps to merge all elements list1 and list2 into a separate list3. (We'll assume data is sorted from least to greatest).

1) Start two index counters (one for each list) which point to the start of the list.

2) Is the element at list1[index1] less than the element at list2[index2]?

  1. If so, add list1[index1] to the end of list3 and increment index1.
  2. If not, add list2[index2] to the end of list3 and increment index2.

3) If either index has reached the end of its list, then add the remaining elements from the other list to list3 and we're done.

4) Otherwise, go back to step 2.

Define the concept network topologies?

The various devise in anetwork can be linked in several ways: Sar, bus or Ring

What is the Data structures used for stack?

A stack is a linear last-in first-out list type data structure. Several implementations are possible. Two examples are the array and the linked list.

The array is quick, but is limited in size.

The linked list requires overhead to allocate, link, unlink, and deallocate, but (except for total available memory) is not limited in size.

One compromise might be a linked list of arrays. Another compromise might be to not necessarily unlink and delete when an element is popped off the stack.

How do you convert from base 10 to base 2 without division?

1. Write out the powers of 2 from 20 = 1 (in right to left order, ie ... 16 8 4 2 1) until you get a power greater than or equal to the number you wish to convert.

2. Put a one (1) under the highest power of 2 that is less than or equal to the number

3. Subtract that power from the number.

4. If the result of the subtraction is not zero, find the next power of 2 not greater than the result of the subtraction and repeat from step 3.

5. Put a zero (0) under all powers of 2 which have nothing under them.

6. The result (under the powers of 2) is the number in base 2.

Example to convert 948 base 10 to base 2:

Write out the powers of 2 until greater than or equal to 948:

Powers: 1024...512...256...128...64...32...16...8...4...2...1

First power less than or equal to 958 is 512:

Powers: 1024...512...256...128...64...32...16...8...4...2...1

Result:.....................1.......................................................................

948 - 512 = 436

Next power not greater than 436 is 256:

Powers: 1024...512...256...128...64...32...16...8...4...2...1

Result:.....................1........1..............................................................

436 - 256 = 180 → 128:

Powers: 1024...512...256...128...64...32...16...8...4...2...1

Result:.....................1........1.........1.................................................

180 - 128 = 52 → 32:

Powers: 1024...512...256...128...64...32...16...8...4...2...1

Result:.....................1........1.........1...............1...............................

52 - 32 = 20 → 16

Powers: 1024...512...256...128...64...32...16...8...4...2...1

Result:.....................1........1.........1...............1......1.......................

20 - 16 = 4 → 4:

Powers: 1024...512...256...128...64...32...16...8...4...2...1

Result:.....................1........1.........1..............1......1..........1...........

4 - 4 = 0, so fill in the zeros:

Powers: 1024...512...256...128...64...32...16...8...4...2...1

Result:.....................1........1.........1.......0.....1......1....0...1...0...0

Thus 95810 = 11 1011 01002

(If the powers are written out in ascending order (from left to right), reverse the final result.)

What are the two WEP key lengths?

A WEP key is entered as a string of numbers and letters and is generally 64 bits or 128 bits long. In some cases, WEP supports 256 bit keys as well. To simplify creating and entering these keys, many devices include a Passphrase option. The passphrase is an easy way to remember the word or phrase used to automatically generate a key.

Why a system does not belong to the information specialists even though they may do most of the work in developing it?

Such specialists are usually paid to do work for others. They may have signed a contract stating that the work they get paid to do doesn't belong to them; even if they didn't sign such a contract, it is usually implicit. For more information, read the Wikipedia article entitled "Work for hire".

How records are logically deleted from files?

You might define a boolean field in the record meaning 'this record is logically deleted: yes/no'.

What is the efficiency of ascii character using asynchronous data with two stop bits?

The efficiency of ascii characters using asynchronous data transfer protocol with two stop bits is 8 in 11, or 72%.

There is one start bit, eight data bits*, and two stop bits. That is 11 bit cells, in which a payload of 8 bits is possible, hence the 8 in 11.

*Actually there are only 7 data bits in ASCII... latin-1 and several other incompatible extensions to ASCII have 8. Which one is in use varies between languages - many European countries use different encodings which have the same meanings for the first 128 characters but different for the second 128 depending on what extra characters are required in the language in question.

If the payload was 7 bits, for pure ASCII, then the efficiency with one start bit and two stop bits would be 7 in 10, or 70%.

Why do we need dynamic initialization of objects in C plus plus?

All objects must be initialised before we can use them. Initialisation can either occur statically (at compile-time) or dynamically (at runtime) however declaring an object static does not imply static initialisation.

Static initialisation relies on constant expressions. A constant expression is any expression that can be computed at compile-time. If a computation involves one or more function calls, those functions must be declared constant expression (constexpr) in order to take advantage of compile-time computation. However, whether or not the computation actually occurs at compile-time or not is implementation-defined. Consider the following code:

constexpr unsigned f (unsigned n) { return n<2?1:n*f(n-1); }

static unsigned num = f (4); // e.g., num = 4 * 3 * 2 * 1 = 24

int main () {

// ...

}

The above example is a potential candidate for compile-time computation. A good compiler will interpret this code as if it had been written:

static unsigned num = 24;

int main () {

// ...

}

However, if the function f () were not declared constexpr, the compiler would instead interpret the code as if it were actually written as follows:

unsigned f (unsigned n) { return n<2?1:n*f(n-1); }

static unsigned num; // uninitialised!

int main () {

num = f (4);

// ...

}

In other words, num is dynamically initialised -- at runtime.

Local objects are always initialised dynamically, as are objects allocated upon the heap (the free store). Static objects may be statically allocated, however this depends on the complexity of the object's constructor as well as the compiler's ability to perform compile-time computation.

What is meant by process aging?

Process aging is the mechanism of the kernel scheduler of slowly reducing the execution priority of the process (more specifically the threads in a process) when that process or thread stays compute bound (or CPU pinned) for more than a short period of time.

This mechanism allows CPU intensive processes to run at a lower priority than IO intensive (or especially interactive) processes. It is a compromise between performance and responsiveness.

Calloc allocates a block of memory for an array of elements of a certain size?

No. The calloc function allocates a block of memory for a count of a specific type. The size of the type is already known to the compiler so does not need to be specified, it will automatically multiply the type's size by the count. With malloc, you have to allocate memory in bytes, therefore you need to calculate exactly how many bytes you will need for a given type and the number of elements of that type.

Examples (allocate 100 integers):

int* p = (int*) malloc (sizeof (int) * 100);

int* q = (int*) calloc (int, 100);

Note also that malloc does not initialise the memory whereas calloc does (the allocated memory is initialised with the value zero). As such, malloc is more efficient when you want to initialise the memory by copying from other memory. That is, there's no point initialising memory you're going to initialise manually, so long as you don't access that memory before it is initialised.

What are the phases of EDP?

Pre training phase

Training phase

Follow-up phase

What are the use of index numbers?

Two reasons: They're often quicker to use and they make for a great filing system.

1) Speed - Suppose I had a set of objects {n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18} that I wanted you to add up, but I wanted you to show your work. Would you rather write this down:

n1 + n2 + n3 + n4 + n5 + n6 + n7 + n8 + n9 + n10 + n11 + n12 + n13 + n14 + n15 + n16 + n17 + n18,

or an equivalent expression, using indexes, like this:

∑(ni, i, 1, 18)?

2) Filing - Suppose I had a 6 X 6 matrix, or array, and I wanted to talk about one specific element in it. If I hadn't done the proper filing, I would be fumbling for words in an effort to describe where it is. "Go two down from the top and 3 over from the left." I'd rather just have them filed and labeled with indexes, like this n3,4.

What is the diff between equality of objects and equality of references that refer to them?

References are equal if they both point to the same object.

o2);

// true because they are meaningfully equal

System.out.println(o1.equals(o2));

}

}

Meaningfully equal is defined by overriding the equals method of class Object.

boolean equals (Object obj) Decides whether two objects are meaningfully equivalent.

4 bit combinational circuit decrementer using full adders?

Use the regular 4 bit full added, but make one of the inputs 1111 = 2's complimentrepresentation of -1. This will serve to decrement the other number by 1. Throw away the 5th bit, the carry bit.

Example

If 5 is entered:

0101

+ 1111

______

0100 = 4

By -: lokesh kourav

contact no -: 9201104655

Why you have two types of memory?

There are more than 2 types of memory. RAM has to be very fast in order for the computer to work quickly enough. Magnetic memory and WORM memory can be slower but is persistent (retains its information when the power is shut off)