answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

Algorithm for calculating the average of 3 numbers?

Algorithm
Step1: Read A, B, C
Step2: If A > B is True, then check whether A > C, if yes then A is greatest otherwise C is greatest
Step3: If A > B is False, then check whether B > C, if yes then B is greatest otherwise C is greatest

Following these steps flowchart can be made.

Explain why programs that are developed using evolutionary development are likely to be difficult to maintain?

When a system is produced using the evolutionary development model, features tend to be added without regard to an overriding design. With each modification, the software becomes increasingly disorganized. System maintenance hampered by these problems, as it is harder identify the source of bugs in poorly designed systems. Also, keeping the documentation up to date over successive "evolution" is uncommon. Poor documentation also makes maintenance more difficult.

  • It leads to implementing and then repairing way of building systems.
  • Practically, this methodology may increase the complexity of the system as scope of the system may expand beyond original plans.
  • Incomplete application may cause application not to be used as the full system was designed.
  • there results incomplete or inadequate problem analysis.

What is global?

Canada is a major world source of minerals, metals, grains, timber and until recently, fish. There is more oil in the Alberta Tar sands than in Saudi Arabia.

Canada has also contributed to what Canadians have regarded as just causes; the two world wars are the best examples. More recently Canada has acted as an international peacekeeping force. Canada has welcomed refugees from all over the world, so much so that some have taken advantage of this.

Canada has sometimes acted as a bridge between our sometimes pugilistic friends to our south and other nations.

Canada contributed to the space program and is active in providing medical care to countries whose people cannot provide it for themselves. Canada is a generator of medical and scientific research.

Canadian schools and universities are world class as are our hospitals.

Not bad for a little guy!

What is the difference between ANSI C and C plus plus?

C is a programming language and ANSI is the standardization committee. The C language is under the auspices of the ANSI committee, which monitors the grammar and structure of the language in a standard way that compiler writers must adhere to.

ANSI C means that it is a standardized version of the C language according to the rules of the committee and should work/compile the same way on any system that uses an ANSI C compliant compiler.

What are the advantage of header linked list?

Header linked list contains a special node at the top,this header node need not represent the same type of data that succeding nodes do,it can have data like,no. of nodes,any data...

header node can access the data of all your nodes

What is insertion sort?

The function on insertion sort is to insert a value into its proper place using an algorithm automatically. It sorts through an array and puts it in the appropriate order according to absolute smallest element.

What is the maximum integer allowed in an integer-type variable?

That varies from each programming language. As a matter of fact, many languages do not put a limit on the maximum size of a variable. It will handle any string, integer, resource, pointer, or other type size, as long as it fits into the memory of the machine running the process.

What is the limitation of DDA line generation algorithm?

1.It drift away from the actual line path because of rounding off float values to integer

2.It causes jaggies or stair-step effect

----------------------------------------------------------------------------------------------------------------

Disadvantage:The accumulation of round of error is successive addition of the floating point increments is used to find the pixel position but it take lot of time to compute the pixel position.

----------------------------------------------------------------------------------------------------------------

More Informationhttp://knol.google.com/k/thiyagaraaj-m/dda-line-algorithm/1lfp8o9xxpx13/78#

http://i.thiyagaraaj.com/articles/articles/dda-line-algorithm

----------------------------------------------------------------------------------------------------------------

the standard version of dda given as in one of its steps as

if(abs(dx)>abs(dy)) steps=abs(dx);

else steps=abs(dy);

this part just supports the positive slop with starting point on left side. Take an example of any other end points as {(8,3) to (2,2) or (4,5) to ( 8,2) or (8,3) to (5,5) } where the slop needs to be negative( for the last two cases) only.

can anyone correct me by suggesting the accurate version of DDA? Or is this the actual DDA??.

What is two types of programming approaches?

Procedural programming, one that is made of one or more procedures and Object-oriented programming (O.O.P.) where a standard model is used for designing using real-world objects to express patterns, called classes in software.

What object-oriented programming language was developed by Sun Microsystems?

Sun Microsystems (now owned by Oracle) did not develop any language in 1990. The development of Java began in June 1991, with the first release appearing in 1995.

What does while mean in computer programming?

The while() statement is used in iterative structures (loops), such that a statement block will iterate so long as a conditional expression evaluates true. The conditional expression can be evaluated at the start or at the end of a loop, thus making it more flexible than the standard for() statement which always evaluates the conditional expression at the start of a loop.

In C++, the while() statement has the following forms:

while( condition ) {

statement;

}

do {

statement;

} while( condition );

In the first form, the statement block only iterates if the condition evaluates true. In the second form, the statement block is executed at least once, and only iterates if the condition evaluates true.

Infinite loops have the following forms:

while( 1 ) {

statement;

}

do { statement;

} while( 1 );

The latter form is redundant since both loops will iterate at least once, however the former is deemed more acceptable in terms of readability than the infinite for() statement:

for(;;) {

statement;

}

As with for() statements, while() loops can use break, return or goto to conditionally exit the loop at any point, or use continue to prematurely begin a new iteration.

Although for() and while() are interchangeable to an extent, the form you use is largely dependant upon which is more readable or makes the most sense in your code. If the condition must be evaluated at the end of the loop then you must use do..while(), but for all other loops you often have a choice of using for() or while(). However, there are differences. Generally speaking, for() statements are used whenever you need to operate upon a control variable in a consistent manner (such as incrementing an index value at each iteration) whereas while() statements are used when changes to the control variable are dependant upon other conditions which are determined within each iteration of the loop itself. Moreover, control variables in while() loops must be in scope prior to entering the loop and will remain in scope when the loop terminates, whereas for() loops can both declare and initialise control variables, rendering them local to the loop. Depending on the type of loop, these facts can help determine which is the better form to use, but in terms of performance there is no real difference. It's all a question of which form makes the most sense for the type of loop you are trying to control.

What the meaning of cell pointers in Microsoft Excel?

A cell pointer in excel is just the cell where you point the cursor in which its row and column can be seen is called a cell pointer.

Describe why it is a bad idea to implement a link list version a queue which used the head of the list as the rear of the queue?

It isn't. In fact it is a very good idea. Since the list is circular, you need only maintain a reference to the tail (rather than the head), because the tail provides constant time access to both the head and the tail. In this way you get constant time insertions at the tail and constant time extractions at the head via a single reference -- exactly what you want from a queue. If the list were not circular, you would need two references, one to the head and one to the tail. That's a waste of memory when the tail has an otherwise redundant link that's always null. Point it at the head and refer to the tail instead of the head and you save memory.

How do you write a program in Basic to display all the even numbers up to 100?

In visual basic:

Module Module1

Sub Main()

Dim Inst As Integer

For Inst = 0 To 100 Step 2

Console.WriteLine(Inst)

Next

End Sub

End Module

How does the for loop work in c?

  • For loop is "Counter controlled loop" i.e. a counter or control variable is used to process the for loop , as discussed in earlier chapters.
  • For loop is an "Entry controlled loop" i.e. the condition to iterate the loop must be check at the starting of the loop and loop body will not execute if the condition is False. Source website:

http://codedunia.in/c-language/for-loop-in-c-programming.php

Write the program in c language for the addition of two matrices using pointer?

#include<stdio.h> #include<conio.h> int main() { int n,m,i,j,k; int a[38][38],b[38][38],p[38][38]; printf("\nEnter the number of rows and coloumns "); scanf("%d %d",&n,&m); printf("\nEnter the elements of first matrix "); for(i=0;i<n;i++) { for(j=0;j<m;j++) { scanf("%d",(*(a+i)+j)); } } printf("\nMatrix is "); for(i=0;i<n;i++) { printf("\n"); for(j=0;j<m;j++) { printf("%d",*(*(a+i)+j)); printf("\t"); } } printf("\nEnter the elements of second matrix "); for(i=0;i<n;i++) { for(j=0;j<m;j++) { scanf("%d",(*(b+i)+j)); } } printf("\nMatrix is "); for(i=0;i<n;i++) { printf("\n"); for(j=0;j<m;j++) { printf("%d",*(*(b+i)+j)); printf("\t"); } } printf("\nAfter ");

Number 15 in binary form?

Rather than tell you what the answer is, I think it better that you learn how to do this your self. By asking the question you must realize that each binary digit can have a value of one or zero. Just like with decimal numbers, the digit of lest value is on the right and has a decimal value of one. The digit immediately to its left has a value that is twice that of it neighbor to the right and also half the value of its neighbor to the left.

Here is the decimal values of 8 binary digits.

[128][64][32][16][8][4][2][1] decimal value

( 8)( 7)( 6)( 5)(4)(3)(2)(1) digit place

Lets convert 25 decimal into binary.

The largest decimal value that can be subtracted is 16 with 3 digits to the left, write down 3 zeros as place holders for the 3 left digits. Follow by a one.

0001

25 - 16 = 9

The next binary digit to the right has a decimal value of 8 and can be subtracted from 9 so we write down another 1.

00011

9 - 8 = 1

Now for each binary digit that has a decimal value greater than the remainder write a zero.

0001100

Now there is just the 1 left to deal with. Any time there is only 1 left you can just write down a 1.

00011001

So with that short intro to converting decimal into binary you should be dangerous enough to do your own decimal to binary conversions. (If still in doubt try, Google for an explanation that makes more sense to you).

Can a program be correct and still not reliable?

It depends on what you mean by the words "correct" and "reliable". A typical notion of correctness means that the program, when executed correctly, does what you want it to do. Similarly, you might want reliability to mean that every run of the program does its job.

This being accepted, it is possible for a "correct" program to prove unreliable, as when you have gamma rays hitting the memory chips and corrupting data. Such cases, while extremely rare (modern digital circuits have extraordinary ECC mechanisms), do occur in practice. An example was when a single bit error in one of Amazon's servers led to a domino crash, and within a few minutes, Amazon's S3 services were down.

Of course, the Amazon example is probably controversial, because fault tolerance is a correctness requirement for their engineers.

It is also for this reason that you'll find building ICs for rockets and satellites is a much harder job than building ICs for everyday use --- the ability to withstand high radiation without corruption being the extra requirement.

At the other end of the spectrum, you have "incorrect" programs which have nevertheless proved extremely reliable. I'm referring to the whole field of randomized algorithms. While these algorithms, strictly speaking are incorrect, they return the correct answer with high probability. Run sufficiently many times, the probability of these algorithms making is a mistake is less than the probability of your being struck by lightning. Unlike correct unreliable programs, these find use literally everywhere in the computer industry.

What are the advantages of paper based communication?

Disadvantages of paper based communication: There are many benefits towards this communication method but they always come at a cost!

Issues arise as cost of sending away Via. stamps and delivery, other areas are the writers hand writing quality along with the grammar and spelling mistakes. Some paper based methods do occasionally result in typed up letters printed off and sent away but these letters can include typo's, other mistakes, Etc. Also when you send away a letter to another destination there is always the issue of the time taken to deliver it as it can take among weeks to even months on delivery and many times, the letter is either damaged or returned which can be again a huge issue! Hope this short explanation is helpful

(I was already doing a report on this subject and thought id contribute to this WikiAnswers subject) -HiddenFang

What is the program language c?

C is a pop language.

C is a case sensetive language.

C is motherof all language.

C is block structure language.

C is a high level language.

C is advace of B language.

C developed by D.richties in 1972 at AT & T Bell lab in USA.

Sachin Bhardwaj

986854722

skbmca@gmail.com

Is it necessary to give the size of array?

Depends on the language. For C, no you don't. You can type blank brackets (int Arr[]) when declaring the array, or you can just use a pointer (int* Arr). Both will allow you to use the variable as an array without having to declare the specific size. Hope this answers your question.

In Java, an array is an object, and one which is dynamically allocated space. The default constructor does not require a size be specified.

What is mean void in c plus plus?

Void means there is no data type. So if you have a void function it does not return a value (and attempting to do so will cause an error) whereas a non-void function (ex. int, long, String, bool, etc) will return a value of that type.

What are the characteristics of object oriented systems?

the three main design principles of object oriented programming are the following:

  • encapsulation - this allows the user to hide the information for outside world and doesn't allow the other user to change or modify the internal values of class.
  • polymorphism - one term in many forms
  • inheritance - offers to derive a new class from an existing one and acquire all the feature of the existing class. The new class which get the feature from the existing class is called the derived class and other class is called the base class.

How can we implement Leaky bucket algorithm in c?

//here is a simple implementation of leaky bucket.

#include<stdio.h>

#include<stdlib.h>

#include<dos.h>

void main()

{

int i,packets[10],content=0,newcontent,time,clk,bcktsize,oprate;

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

{

packets[i]=rand()%10;

if(packets[i]==0) --i;

}

printf("\n Enter output rate of the bucket: \n");

scanf("%d",&oprate);

printf("\n Enter Bucketsize\n");

scanf("%d",&bcktsize);

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

{

if((packets[i]+content)>bcktsize)

{

if(packets[i]>bcktsize)

printf("\n Incoming packet size %d greater than the size of the bucket\n",packets[i]);

else

printf("\n bucket size exceeded\n");

}

else

{

newcontent=packets[i];

content+=newcontent;

printf("\n Incoming Packet : %d\n",newcontent);

printf("\n Transmission left : %d\n",content);

time=rand()%10;

printf("\n Next packet will come at %d\n",time);

for(clk=0;clk<time && content>0;++clk)

{

printf("\n Left time %d",(time-clk));

sleep(1);

if(content)

{

printf("\n Transmitted\n");

if(content<oprate)

content=0;

else

content=content-oprate;

printf("\n Bytes remaining : %d\n",content);

}

else

printf("\n No packets to send\n");

}

}

}

}