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

What are the advantages of distributed memory?

Advantages

  • Can drastically increase processing speed
  • Can be infinitely expandable - just keep adding computers
  • Security through redundancy
  • Collaborative processing
  • Distributed Database

Disadvantages

  • Not all situations are suitable for distributed computing
  • A lot of extra programming is required to set up a distributed system

What is mdi form in visual basic?

MDI (Multiple Document Interface) is a Microsoft Windows programming interface for creating an application that enables users to work with multiple documents at the same time. Each document is in a separate space with its own controls for scrolling. The user can see and work with different documents such as a spreadsheet, a text document, or a drawing space by simply moving the cursor from one space to another. An MDI application is something like the Windows desktop interface since both include multiple viewing spaces. However, the MDI viewing spaces are confined to the application's window or client area . Within the client area, each document is displayed within a separate child window . MDI applications can be used for a variety of purposes - for example, working on one document while referring to another document, viewing different presentations of the same information, viewing multiple Web sites at the same time, and any task that requires multiple reference points and work areas at the same time

What are subscripts in c language?

Subscripts are used when accessing arrays. An array is a contiguous block of memory containing two or more elements of the same type. Since each element is the same length, it is trivial to work out the offset address of one element relative to another using a zero-based index. For any type T, the type T[n] is an array of Ts with indices in the range 0 to n-1. We can also create arrays at runtime by allocating sufficient memory on the heap for the given type:

void f(int n) {

if (n<1) return; // cannot allocate 0 elements!

int* ptr = malloc (n * sizeof(int)); // allocate memory for n integers

if (ptr!=0) return; // ensure memory was allocated!

ptr[0] = 42; // use subscript operator to assign a value to the first element

// assign to other elements...

// use array...

free (ptr); // release memory as soon as we're finished with it

}

What is the complexity of insertion sort?

The complexity of Insertion Sort is O(n^2). This is the same complexity as Bubblesort, but is more efficient (quicker). However, it is unsuitable for large data sets which are best handled using an Introsort with O(n log n) complexity.

What are function pointers?

Function Pointers are basically used when we want to select a function which is to be used dynamically at run time.

AnswerFunction pointers are the only way for "Interept programming". In UNIX all the Interepts are called using function pointers. This is mainly used in system programming. Answerits nothing but a pointer to function. which is similar to ptr to a variable, if we are saying ptr to a variable then it will hold address of the variable like that fn. ptr will have the address of the function..

one of the major application of the function pointer is call back function.. i.e callback.

AnswerPointers to functions/methods/subroutines aka 'Delegates' are frequently used in .NET programming especially in EventHandling, MemberInvoking

<><><>

A function pointer is used to pass a function as an argument to another function, or to store a function as a data item, for example a list of functions can be implemented as an array of pointers to functions. Function pointers are used to store interrupt handlers in tables.

What are the differences between Bresenham's line algorithm and Bresenham's circle algorithm?

These two algorithms are almost completely different. The only real similarity is that they are each designed to use only integer addition/subtraction and multiplication, avoiding expensive division and floating point operations.

Complexity of an algorithm in data structure?

* search array => O(1) linked list=> O(n) binary tree=> O(log n) hash=>O(1) * search array => O(1) linked list=> O(n) binary tree=> O(log n) hash=>O(1)

Java program to illustrate Wrapper class?

java uses simple or primitive data types, such as int, char and Boolean etc. These data types are not part of the object hierarchy. They are passed by value to methods and cannot be directly passed by reference. However, at times there is a need to create an object representation of these simple data types. To address this need, Java provides classes that correspond to each of these simple types. These classes encapsulate, or wrap, the simple data type within a class. Thus, they are commonly referred to as wrapper classes.

Wrapper classes corresponding to respective simple data types are as given in table below.

Primitive Data Types

Wrapper class

byte

Byte

short

Short

int

Integer

long

Long

char

Character

float

Float

double

Double

boolean

Boolean

void

Void

eg

Say supposing there is a requirement to store only the

object in an array A.The Primitive types cannot be stored in

the same array as the array can accommodate only Objects

here is where Wrapper Class come into picture.ie, we create

wrapper for the primitive types.One such example is as below

Ex:int i;

Wrapper class for the primitive type(int) is created as below:

Integer i = new Integer();

What are the advantages of insertion sort?

It is less efficient on list containing more number of elements.

As the number of elements increases the performance of the program would be slow.

Insertion sort needs a large number of element shifts.

What are the Application of tree and graph in data file structures?

Using binary tree, one can create expression trees. The leaves of the expression tree are operands such as constants, variable names and the other node contains the operator (binary operator). this particular tree seems to be binary because all the operators used are binary operators. it is also possible for a node to have one node also, in case when a unary minus operator is used.

we can evaluate an expression tree by applying the operator at the root to the values obtained by recursively evaluating the left and right sub trees.

Any five uses of computer in Scientific Research?

It is used for

1.to do complex computations

2. for data analysis

3. modelling

4.Calculations

5.Storage and Data Transfer

6.Mapping

-SubhaGolu

How can you fix an ArrayIndexOutOfBoundsException in java?

This is very common exception and name of the exception class tells exactly what kind of problem you have. If you would look into stack trace, which should have been generated too you would be able to find exact place where it happened.

The problem is that "Array Index Out Of Bounds". This means that you used index on array which is invalid. That could negative number, because all arrays starts from 0. If you array has N items and you will try to get item with index N or higher you will get this exception too. Only available indexes are from 0 to N - 1, where 0 points to the first item and N - 1 to the last one.

Data abstraction and encapsulation in java?

Abstraction

Abstraction is simplifying complex reality by modelling classes appropriate to the problem, and working at the most appropriate level of inheritance for a given aspect of the problem.

For example, Lassie the Dog may be treated as a Dog much of the time, a Collie when necessary to access Collie-specific attributes or behaviors, and as an Animal (perhaps the parent class of Dog) when counting Timmy's pets.

Abstraction is also achieved through Composition. For example, a class Car would be made up of an Engine, Gearbox, Steering objects, and many more components. To build the Car class, one does not need to know how the different components work internally, but only how to interface with them, i.e., send messages to them, receive messages from them, and perhaps make the different objects composing the class interact with each other.

Encapsulation

Encapsulation conceals the functional details of a class from objects that send messages to it.

For example, the Dog class has a bark() method. The code for the bark() method defines exactly how a bark happens (e.g., by inhale() and then exhale(), at a particular pitch and volume). Timmy, Lassie's friend, however, does not need to know exactly how she barks. Encapsulation is achieved by specifying which classes may use the members of an object. The result is that each object exposes to any class a certain interface - those members accessible to that class. The reason for encapsulation is to prevent clients of an interface from depending on those parts of the implementation that are likely to change in future, thereby allowing those changes to be made more easily, that is, without changes to clients. For example, an interface can ensure that puppies can only be added to an object of the class Dog by code in that class. Members are often specified as public, protected or private, determining whether they are available to all classes, sub-classes or only the defining class. Some languages go further: Java uses the default access modifier to restrict access also to classes in the same package, C# and VB.NET reserve some members to classes in the same assembly using keywords internal (C#) or Friend (VB.NET), and Eiffel and C++ allow one to specify which classes may access any member.

What steps are required form an algorithm to convert a binary number to it's decimal equivalent?

Let's look at an example. If you want to convert the number 100112 to decimal you can split up the number so each digit has an index associated to it:

4 3 2 1 0

1 0 0 1 1

We can then find the decimal value:

24 * 1 + 23 * 0 + 22 * 0 + 21 * 1 + 20 * 1 =

16 * 1 + 8 * 0 + 4 * 0 + 2 * 1 + 1 * 1 = 16 + 0 + 0 + 2 + 1 = 19

So what we need to do is to multiply each of the binary digits by the value of two raised to the index of the digit. This will give you the conversion from any binary number to a decimal number.

What are the attributes of image tag?

The body tag in HTML 5 does not support any element-specific attributes. It does however support the global attributes, and the event attributes.

Please see the related links for a complete reference.

What is difference between Adapter class and listeners in java?

An Adapter class is just a "blank" implementation of a Listener interface. They're convenience classes made so you don't need to implement all of the methods of an interface.

A good example is the MouseListener interface. Let's say you want to detect when a user clicks on your Component. You only need to implement the mouseClicked method to get that part working. This will leave you with...

public void mousePressed(MouseEvent e) {

}

public void mouseReleased(MouseEvent e) {

}

public void mouseEntered(MouseEvent e) {

}

public void mouseExited(MouseEvent e) {

}

...at the end of your implementation. Ugly. So Java gives us the MouseAdapter class (which gives us the same empty implementations as above). We can use this in place of a MouseListener to try to keep our code cleaner.

What is IT architecture and infrastructure?

Basically it's all of your networks and supporting systems and in some cases the entire IT department as well.

What is the definition of circular queue?

A queue is simply a FIFO i.e first in first out. In queue we've front and rear. Front is the initial or first location of the queue whereas rear indicates the last entry location in the queue. In the circular queue the location of front and rear will be the same IF the total space of the circular queue is utilized. Each element has its position no. for insertion , if we set the 5th element as the front element then after every insertion the ptr indicates the 5th element as front. in deletion, the fifth element is deleted every time it is the rear position. after deletion of an element the queue rotates and every time the rear indicates the 5th element of the circular queue. and every time the 5th location element is deleted.

What is the difference between a constructor and its corresponding overloaded assignment operator?

The copy constructor is used to initialize a new instance from an old

instance, and is called when passing variables by value into functions

or as return values out of functions.

The assignment operator is used to change an existing instance to have

the same values as the rvalue, which means that the instance has to be

destroyed and re-initialized if it has internal dynamic memory.

How do you design and implement an application that determines and prints the number of odd even and zero digits in an integer value read from the keyboard?

Firstly you would need to get the user input and initialize some variables (This is all done in C#):

string text = Console.ReadLine();

int numberOfEven = 0;

int numberOfOdd = 0;

int numberOfZero = 0;

int number = 0;

Then you would need to loop through the string to see for the odd and even numbers:

while(number < text.Length) // Loops through how many times there are // numbers in the string

{

if (text[number] 0) // Just like the one before, checks if it is // odd

{

numberOfOdd ++;

}

number ++;

}

And you can print off each of the integers to get how many evens, odds and zeros there are.

Write a Flowchart for Fibonacci series?

1.start

2.a=0,b=1,c and counter

3.display a

4.display b

5.c=a+b

6.display c

7.a=b

8.b=c

9.check whether number is less than the last number you have

if yes than go to step 5

if no stop it

What are the applications of array?

arrays are used to store the group of data which are of same type.

These arrays can be applied in student mark sheet applications,online library applications etc.

Disadvanatges of object-oriented programming languages?

  • OOP is a more complicated and structured paradigm than, say classic procedural programming.
  • More planning and design is required on the programmer's part.
  • OOP is less efficient in terms of a computer's resources than most other paradigms.
  • OOP is a complex idea - no language including Java and C++ implements it perfectly.
  • OOP may be overkill for smaller, simpler programs.