answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

How much does broadband internet cost?

It depends upon the services that you wish to use. Dial up service can be free, but is exceedingly slow. On top of this, it relies upon you having a phone line.

Other internet services are faster, but vary greatly in cost. For example, I have cable internet which gives me 18 mbps download speed and 1 mbps upload speed with a total bandwidth cap of 250 GiB per month, and costs me $40 a month.

A T1 line, however, gives 1.544 mbps and yet can cost several hundred dollars a month! While this may seem like a horrible deal compared to cable internet, the advantage to a T1 line is that the T1 line generally comes with a service level agreement - guaranteeing you access to this bandwidth. These are generally leased out to businesses who need to guarantee that they have this internet access for 99.9% of the month.

A cable operator, on the otherhand, might only guarantee you internet access at the advertised rate 40% of the time.

What is flowol?

flowol is an internet based programme used to make flowcharts ")

Explain why a class might provide a set method and a get method for an instance variable?

A class might provide a set method (setter) and a get method (getter) for an instance variable in order to encapsulate the internal implementation of the class, and to isolate that implementation from the public interface of the class.

Even if the setter and getter does no more than directly set and get the instance variable, the public interface should use that paradigm in order to allow for possible future alteration of the implementation, while minimizing the impact of doing so.

Proper OOD/P (Object Oriented Design/Programming) should always make the implementation be private, even for derived classes. This reduces error, and reduces "lazy" coding techniques.

A 1 or 0 in the binary number system is called?

A 0 or 1 in a binary number is called a bit. A binary number is made up of only ones and zeroes.

What are the some biological terminologies?

* homogenise (blend) * hydrolyze( hydrolysis) * dehydration (removing water) * insoluble (does not dissolve) * soluble (dissolve)

What is a prodecural programming language?

A procedural programming language is one where programs are organized into blocks of code called variously "subroutines", "functions", or "procedures", each of which handles one particular task. The main function of the program (often actually called "main") then makes a series of calls to these procedures in order to archive its goal.

How do you make a function repeat itself in C plus plus?

There are three ways to do repetitions in C as far as I know. The first is to use recursion (a function which calls itself) the second being a for loop and the third being a while loop, though both of these are basically the same thing. Here's a demonstration of using these three methods to compute the x raised to the power of y: (note this isn't the most efficient way of calculating the power of a number but it's good enough for an example)

//Recursion:

int pow(int base, int pwr){

if(pwr == 0){

return 1;

}else{

return base * pow(base, pwr - 1);

}

}

//For loop

int pow(int base, int pwr){

int i;

int result = 1;

//The for loop initialises i to the value of pwr, then

//runs the loop, subtracting 1 from i each time until

//i fails the test (i > 0) at which point the loop finishes

for(i = pwr; i > 0; i--){

result *= base

}

return result;

}

//While loop

int pow(int base, int pwr){

int result = 1;

while(pwr > 0){

result *= base;

pwr--;

}

return result;

}

What are macros in c?

In C macros are a piece of code that is replaced by its value whenever it called from.

Syntax for defining a macro is :

# define Macro_Name Value

As:

# include<stdio.h>

# define three 3

int main(){

printf("%d", three);

return 0;

}

output: 3.

In above example three is a macro and its value is 3.

The place for defining macros are same as including a header file in a program.

What is Size of int variable in c?

The size of an int variable in c is a function of the compiler implementation. It is usually a word in the underlying computer architecture. Original Microsoft C/C++ compilers for the 16 bit platform defined an int as 2 bytes. Current compilers for the 32 bit platform define an int as 4 bytes. The current ANSI C standard provides that an int is at least 4 bytes, but it could be higher, say 8 bytes on a 64 bit platform.

Why should we know algorithm?

This is a question I asked myself when I was studying algorithms.

Algorithms are important because of how crucial they are to so many real world applications. Just a few examples are web searching, file sharing, file systems, compilers. Getting a computer science job without knowing anything about algorithms would severely limit you, probably would only be able to find a GUI programming job.

Almost all big companies like Microsoft, Google, Yahoo and Amazon use algorithms in their software and look for engineers who understand them very well. Having a very strong grasp of algorithms in a job interview would set you apart from all others who only simply know how to program.

Basically you need to study algorithms because they are used all the time in complex software projects.

In short you want job then learn algorithm.

What are the four phases of computer data processing?

Identify the problem. Develop a solution. Implement the solution. Monitor the results.

Answerinput

process

output

What is the purpose of an assignment statement?

An assignment statement sets the value of a named object. This can be used to initialise the object's value or to change the object's value. The object may be a constant or variable, however you can only initialise a constant, not change it.

int i = 42; // Assigns the value 42 to the integer variable named i.

i = 0; // Replaces the value 42 with the value 0.

const double pi = 3.14; // Assigns the value 3.14 to the constant named pi.

pi = 3.14159; // Compiler error; pi is constant!

Why use multiple processes instead of multiple threads?

You use a process when you want a separate program, and a thread when you want to asynchronously execute some different code contained within the same program.

A process is an address space containing instructions, data, stack, etc. It represents one load module (or program) loaded into memory, ususally by the operating system's exec or equivalant call.

There can be more than one process loaded from the same load module. They are separate and distinct, even though they might share regions of instructions and constant data. As an example, the execution of ksh (in linux) or cmd (in windows) represents a process.

While executing, a process can invoke another process, either a copy of itself or a different one. For example, ksh can invoke ls, and cmd can invoke explorer. Keep in mind that this is still a different address space. In the case of linux, the process actually makes a copy of itself (fork) and then overlays itself with the new load module.

A thread, on the other hand is an execution path through a process. Every process has at least one thread, which starts with the first instruction it executes after being loaded, and ends with the call to the exit or equivalent operating system call.

So, to clarify, what executes is actually called a thread, and the process is just the address space. Different naming conventions do exist - this is the windows (and some other OS's) convention.

{Restating from three paragraphs before} While executing, a thread can load another process, either a copy of its containing process or a different one, or it can invoke a new thread within itself. While the difference might seem slight, it is not, because the (now two) threads share the same address space, and they can easily communicate with each other, assuming appropriate synchronization is used.

In the case of linux, you could say that a separate process is started as fork followed by overlay, while a new thread started as fork without the overlay.

Each thread has its own copy of its local variables, and a copy of the invoking parameters. In the simple case, that is sufficient. In the more complex case, involving explicitly allocated heap memory, either different heaps are used, or a mechanism for synchronized sharing is implemented.

What is an uninitialized pointer?

It means "nothing", there is no data provided at all; just an empty value.

Contrary to the previous edit it does not mean "zero", "none" or "blank"; as zero is a number and none and blank can be regarded as data.

What input you will give to write a basic program to find prime numbers between 1 to 100 using if and else?

#include <iostream> void main() { using namespace std; int num, rem, sum=0; //Declaring variables cout<<"Enter a number :"<<endl; cin>>num; //Loop to calculate the sum of the digits of the given number. while(num!=0) { rem=num%10; num=num/10; sum=sum+rem; } cout<<"Sum of the digits is "<<sum<<endl; cin.get(); }

What are advantages and disadvantages of contiguous memory allocation?

The advantage of contiguous memory allocation is

1. It supports fast sequential and direct access

2. It provides a good performance

3. the number of disk seek required is minimal

The disadvantage of contiguous memory allocation is fragmentation.

Job description of encoder?

In software, an encoder takes some data and transforms it into a format suitable for storage or transmission.

In hardware, an encoder which takes multiple input lines and outputs the binary representation of the single input line which is set to high. Since it is difficult to guarantee that only a single input line will be high at the same time, a priority encoder is generally used instead.

Difference bw linear and nonlinear data structure?

A data strucutre is classified into two categories: Linear and Non-Linear data strcutures. A data structure is said to be linear if the elements form a sequence, for example Array, Linked list, queue etc. Elements in a nonlinear data structure do not form a sequence, for example Tree, Hash tree, Binary tree,etc. There are two ways of represneting linear data strucutresin memory.One way is to have the linear relationship betweent he elements by means of sequential memory locations. Such linear strucutres are called arrays. The other way is to have the linear relationship betweent he elements represnted by means of links.Such linear data strucutres are callled linked list.

What are the types of loops?

There are three forms of loop commonly used in C/C++, the for loop, the while loop

and the do-while loop.

The for loop is most commonly used whenever an action is going to be performed a set amount of times. For example, to sum every element in an array:

for(i = 0; i < arraySize; i++)

{

sum = sum + array[i];

}

The while loop and do-while loop are commonly used to loop until a condition is met. The difference between the two is that the do-while loop goes through one iteration before checking its condition, while the while loop checks its condition before any execution of the loop.

Example do-while loop:

do

{

randomNumber = rand() % 10;

}while(randomNumber != 6);

Example while loop:

cout > number;

while(number < 0)

{

cout > number;

}

What makes the binary system so applicable to computer circuits?

Binary is the simplest way to implement operations and information in a computer system.

However, It is not the only way.

But because of the nature and simplicity to switch electricity on and off it is a natural for computers.

Computers speak only one language which is composed of two sylables, namely "on" and "off". This is just like your light switch on the wall.

Computers are made up of millions of switches. This complexity allows logic functions, similar to human thought, to be performed.

This manifests as a very impressive operation only because a computer operates at such fast speeds.

How you pass array elements to a function?

Passing array elements to a function is achieved by passing the individual elements by reference or by value, just as you would any other variable. However, passing the entire array requires that you pass a pointer-to-pointer to the array along with the dimension(s) of the array.

Importance of virtual functions?

Private virtual functions are useful when you expect a particular method to be overridden, but do not wish the override to be called from outside of the base class. That is, the base class implementation and its overrides remain private to the base class.


Private virtual methods are particularly useful in implementing template method patterns, where certain algorithmic steps need to be deferred to subclasses, but where those steps need not be exposed to those subclasses. In many cases the private virtual methods will be declared pure-virtual, thus rendering the base class an abstract base class.