answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

What is the best pivot version?

3 is glitchy so 2 is the best well sover far i like pivot animator v.3

How can plants benefit from fire?

Fire triggers germination in some plants (eg. eucalyptus). They can also re-establish woodland areas, which is especially useful after extensive logging. Most importantly, they reduce the amount of available fuel in the area, reducing the chance of high risk fire occurance and overall destructive impact. People who are passionate about natural forests must accept that fire is an important ecological process, vital to the ongoing life of many plant species.

What are the major differences between message-passing and shared-address-space computers?

Shared-address-space platforms

Message passing platforms

Common data space accessible to all processors.

Each processing node has its own exclusive address space.

Processors interact by modifying data objects stored in this address-space.

Processors interact by using message passing, hence the name.

Memory can be local (exclusive to one processor) or global (common to all processors).

Each processor's memory is exclusive to it.

Is deleting the only node in linked list a special case?

It depends on whether or not you have a head node. If you do, then it is not a special case. If you don't, then it is, and you need to be able to update the head pointer.

What is socket programming in C?

There is nothing called "socket programming in C."

Sockets can be programmed in any programming language. What follows below is a basic idea on how to program sockets.

Socket programming refers to the use of a set of APIs for sending and receiving data over a network. The socket APIs originated on the BSD OS standardized by POSIX and are now found on UNIX, Linux, Windows, and Mac OS.

The concept of a socket is an abstraction for an end point in network communication through which data can be sent to and received from.

The major socket API functions are:

* socket() -- creates a socket of specified type and protocol * bind() -- assigns a local name or address to the socket (in the IP protocol this is usually an IP address and port * connect() -- connects a socket to a remote end point * listen() -- changes the socket's state to listen for incoming connections * accept() -- accepts an incoming connection and returns a new socket for communication over that connection * send() -- send data to remote end point specified with connect() call * sendto() -- in connectionless protocols such as UDP, sends data to a specified remote end point * recv() -- receive data from remote end point (after connection established) * recvfrom() -- receive data from a specified remote end point in connectionless protocol * getsockopt() -- gets current value for a particular socket option

* setsocketoption() -- set value of a particular socket option

Comparison between linked and array lists?

The difference between linked and array lists is in how they are stored. Arrays are a predefined block of memory into which information is stored or recalled. Any data element from an array can be retrieved in O(1) time. But if you need to increase the size of the array, you would need to create a new one and copy the contents of the old one into it. Linked lists are usually dynamically allocated during run time, and the only way to get to a node (a data element) is to traverse the list until you find it which makes the retrieval time slower O(n) . The benefit of a linked list is that you can insert new data elements without having to copy or move all the elements in the list as you would in an array. The linked list is better for large databases that need to add and remove items often, whereas arrays are better for list sizes that generally don't change.

Who founded wipro?

M. H. Premji founded wipro in 1945.

What is a binary response?

Two mutually exclusive outcomes. You flip a coin, and only heads and tails are possible.

What are some reasons information systems may not succeed?

The reason is bacuase a lot of people don't know anything about those systems, others are not taking the fact that information is important and needed seriously, because all they tend to focus on is technology only, forgetting about who's going to use it , the infor needed for it to successfully run and last but not least tend to forget about the information they need and the means that they need to use for infor to be gathered , organized and retrieve when /if neccessary.

What is the technical name for calling a base class constructor using derived class constructor?

You cannot actually call any constructor, you can only invoke construction, either by instantiating a static instance of a class or by dynamically creating one with the new operator. In the case of base class construction via a derived class, the base class constructor is invoked by the derived class' initialisation list.

Every class constructor has an initialisation list whether you define one or not (the compiler will generate one automatically if you don't). When you derive one class from another, the derived class initialisation list invokes a call to the base class default constructor. The only exception is the compiler-generated copy constructor which automatically calls the base class copy constructor.

If you define your own initialisation list, then you can explicitly invoke any base class constructor overload, thus making your construction code all the more efficient. However, copy constructors should always invoke the base class copy constructor, so if you define a copy constructor, you must explicitly invoke the base class copy constructor -- the compiler will not invoke it implicitly from a user-defined copy constructor.

While many programmer's use the constructor's body to initialise a class, this is highly inefficient. Even if you don't specify an initialisation list, one is created for you, resulting in every base class and every member variable being initialised twice, which can quickly add up to a substantial cost in performance.

The constructor's body should only really be used for initialisation when it would be difficult or impossible to do so from the initialisation list. Remember that your object doesn't physically exist until initialisation is complete, so you may not have access to some members, particularly base class members, at certain points in the initialisation process.

Initialisation must be done from the ground up, starting with the base classes and ending with the actual class members, and all in the order they were declared. Note that only direct base classes (or virtual base classes) should be invoked from the initialisation list. The base classes themselves should invoke their own base class constructors, if they have any. Thus no matter which derivative you construct, the least-derived class is always constructed first.

Why should indexes be used instead of subscripts to identify array elements?

You cannot uses indices instead of subscripts. The subscript operator [] requires an index in order to determine the subscript. Even if you don't use the subscript operator you still need an index to determine the offset of the subscript. Indeed, the only time you do not need an index is when traversing the array using a roving pointer, which is arguably more efficient than using a subscript to traverse an array since subscripts use multiplication instead of the much simpler increment/decrement operation.

What is local variables default value?

None. If you don't initialize them, you find garbage in them.

What disciplines of engineering are the least programming intensive?

The umbrella answer is that any field of engineering which does not deal with computers or automation will have the least programming. This includes civil and structural engineering (building bridges and other infrastructure) and geotechnical and mining engineering.

However, you should expect to use programs as a user in all engineering domains, i.e. Autocad, etc.

Can calculate the centre of gravity of irregular shape by aid any software?

With autocad software

1.Draw any shape

2.Covert to poly line

3.Type region in command bar

4.Type massprop in command bar

5.Note down values of centroid(x,y) by pressing F2

6.Type line command

7.Input centroid values(X,y) in command bar

8.centroid of the particular shape can be located.

Tyr it

BEST OF LUCK

How would you write a program that counts the number of vowels in a string in assembly language?

int countVowels(const char* str) {

int i = 0;

int numVowels = 0;

while(str[i] != '\0') {

switch(str[i]) {

case 'a':

case 'e':

case 'i':

case 'o':

case 'u':

++numVowels;

}

++i;

}

return numVowels;

}

static int countVowels(String str) {

int numVowels = 0;

foreach(char ch in str) {

switch (ch) {

case 'a':

case 'e':

case 'i':

case 'o':

case 'u':

++numVowels;

break;

}

}

return numVowels;

}

What is Variable Scope?

The scope of a variable is the range, or area, in which a variable exists.

// this c is global and can be referenced from anywhere

int c = 1;

void foo() {

// this c is local to function foo and can't be referenced from the outside

int c = 2;

}

void bar() {

// if we try to reference c here, we get the value 1 from the global variable

}

What is high-level language compiled?

Compiling a high-level language means that the high-level source code (what is typed by the programmer) is being converted to machine code (binary, i.e. 0's and 1's) that the local computer can execute. In interpreter languages, the source code is first converted to byte code, which is either run directly (slower, but very portable), or interpreted by a virtual machine (see JVM) into machine code, and then executed (faster, but somewhat less portable). If an error is found the compilation stops and the errors are displayed.

What optional statement can be used in a case structure to execute statements when all other conditions are false?

default : <statement>;

i.e.

switch (value) {

case 1 : do_this(); break;

case 2 : do_that(); break;

default : do_whatever();

}