answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

When you enter your password for the first time you are asked to enter it twice What is this process called and why do you do it?

THEY DO THAT SO THEY CAN VERIFY YOUR PASSWORD. jUST THINK OF IT THIS WAY THE COMPUTER IS TRYING TO SAVE YOUR PASSWORD IN THE HARDRIVE SO IF YOU CHANE COMPUTERS NOT HARDRIVES IT WILL BE IN THERE, ALSO THE COMPUTER IS NOT FAMILIER WITH IT. Its called validation. The page or program is validating one to the other to make sure they match, which means that you didn't mistype it. Passwords are usually unreadable when you input them. Because of this, if you mistype it you cannot tell. Validation help to prevent this.

What is GPS DGPS and the frequently used algorithm used in programming DGPS?

DGPS is one of two widely used methods to augment the accuracy of the GPS.

Most GPS chips will follow the NMEA standard so that is usually the preferred way of parsing both GPS and DGPS data. Check out the related links for a link to the NMEA GPS standard.

What is the latest version of Microsoft Excel?

If by Microsoft you mean the Windows operating system:

The latest general OS is Vista (6.0.6002)

The latest server OS is Windows Server 2008 (6.0.6002)

The latest (release candidate) for Vista's successor is Windows 7 (6.1.7100)

What is the importance of Microsoft Windows?

Microsoft Windows is important to our lives since it offers a visual interconnection of the user, with menu, icons, dialog boxes, and the possibilities to run MS-DOS. It has provided functions that are simple to use and they have made their software affordable.

Why is punctuation and format important things to consider when writing code?

Punctuation and format (or syntax) are important because language compilers require them in order to interpret your code correctly, in much the same way punctuation helps a reader understand the written word. For example:

"Most of the time travellers worry about their luggage."

Time travellers? No, what we really mean is:

"Most of the time, travellers worry about their luggage."

A simple comma changes the entire meaning of the sentence. The comma represents a small pause in the sentence -- exactly as we would have said it aloud.

What Is a social engineering practice in which a person attempts to glean access or authentication information by posing as someone who needs that information?

This practice is known as phishing, where an attacker impersonates a legitimate entity to deceive victims into providing sensitive information such as passwords or credit card details. Phishing is commonly carried out through emails, phone calls, or text messages, and aims to exploit human psychology and trust to gain unauthorized access to accounts or data. It is important to be cautious and verify the authenticity of requests for personal information to protect against phishing attacks.

What is the difference between internal and external variables?

An internal variable will change due to computations in the program module. An externalvariable will change due to other changes (external input).

What is the difference between an algorithm and heuristics?

An algorithm is a step-by-step procedure for solving a problem, typically involving a finite number of steps. Heuristics, on the other hand, are general problem-solving strategies that may not guarantee a correct solution but can often lead to a quicker or simpler resolution. Algorithms are precise and deterministic, while heuristics are more flexible and open to interpretation.

What are the uses of algorithms?

  1. An algorithm can be a part of a computer program.
  2. An algorithm can be a written paper procedure for a human to read and follow. (e.g. you bought a new device to use on your computer, it comes with a procedure to set it up, connect it, and install drivers.)

Once an algorithm has been developed, no thinking is required just mechanically follow the steps until finished. This makes it ideal for both computers (which understand nothing) and people that may not fully understand all of what they are doing.

Why people feel threatened when they are informed that thinking computer programs are in fact quite simple and they are able to learn?

The potential of eliminating jobs in the marketplace. People fear unemployment. People also fear change in general. They get used to something a certain way. Some things are just mind boggling if the person hasn't been keeping themselves up to date as technology has progressed. I think the other thing is that there are so many "new and big" words that have evolved with computers in general, that if you don't understand all of the terminology - how can you learn a system that you cant even apply the English language too?

What is an example of a logic error?

A logic error (also known as a semantic error) is a flaw in the thought process behind a piece of code, in such that although the code itself is written correctly it does not serve the intended purpose for which it was written.

An example of this in basic English would be aiming to add 1 and 1 together to get 2, but accidentally using the minus symbol instead of the addition; the sum can still be done, but it will yield an incorrect result.

Transfer that to a simple bit of code then:

Dim a as Integer = 1

Dim b as Integer = 1

Dim c as Integer

c = a - b

MsgBox("Look! I added 1 and 1 together and got: " & c)

Obviously since the intent was to add two numbers together, there is a flaw in the logic of the code.

A logic error is notoriously difficult to debug from a program due to the fact the code itself is written perfectly correctly; this means the code will not crash and error detectors have no way of knowing what you intended the code to do if it worked correctly.

Logic errors are traditionally solved through the tedious method of tracking variables and going line by line through the code one step at a time, following it logically through each step until you find the exact point an incorrect value is generated; thus identifying the segment of faulty code.

What is the origin of analytical intelligence?

Analytical intelligence is a component of general intelligence that involves problem-solving, logical reasoning, and critical thinking. It is thought to have evolutionary origins as humans needed to navigate complex social and environmental challenges to survive and thrive. Analytical intelligence is influenced by both genetic factors and environmental experiences.

Where can one find comprehensive and up to date tutorials for programming languages?

As per your convenience. Here are Java courses. The Course Content and Certifications are provided by IIT Bombay Spoken Tutorial Project. Newtum is the Associate Partner.

Visit Newtum And find Java Courses.

Why is anthropology science?

Sociology can be considered a science as it involve systematic methods of empirical research, analysis of data and the assessment of theories. In addition,it asks questions which can be quantified.

When did cnc start?

CNC (Computer Numerical Control) technology was developed in the late 1940s and became more widely used in the 1970s as computers and software became more advanced. It has since revolutionized the manufacturing industry by automating and controlling machining tools with precision.

What is the advantage of doubly linked list over singly linked list?

It's not that one is better than the other. They are used in different circumstances. A linear linked list is used like an array, with the added benefits of random insertion/removal of elements, etc. A circular linked list is often used as a buffer where one portion of the program produces data and another consumes it, such as in communications.

What is hetrogenious linked list?

A heterogeneous linked list is a linked list where each node can store different types of data. This is different from a homogeneous linked list where all nodes store the same type of data. Heterogeneous linked lists can be useful for scenarios where you need to store multiple types of data in a single list.

What is a circular singly linked lists?

A circular singly linked list is a memory structure in programming that supports walking around the list in a circle. Such a list is almost always written in the following form:

class ListNode {

public ListNode nextNode;

public Object nodeData;

public void addNode(Object newData);

public void removeNode();

}

Note that I've just generalized the data structure, as each language will have a specific syntax that has to be followed.

The data is organized such that if you follow nextNode indefinitely, you will eventually circle all the way back to the original node you started at. This is the "circular" part of this list. Going in a circle is done like this:

while(ListNode node = CurrentNode.nextNode) {

/* Do some processing here */

}

Depending on the actual use case, care must be taken to ensure that you are not truly going around infinitely.

The "singly linked" part is identified by the single pointer (or reference, if you will) to the next available node, called nextNode. A "doubly linked" structure would also contain a "previousNode" pointer/reference.

void addNode(Object Data) {

ListNode temp = new ListNode();

temp.nextNode = CurrentNode.nextNode;

temp.Data = Data;

CurrentNode.nextNode = temp;

}

Inserting a new node can be done by inserting after the current entry. Inserting in place of the current entry would be slightly more complex, because you'd have to move the data pointers in the current node to the new node, then place the new data into the current node.

void removeNode() {

CurrentNode.nextNode = CurrentNode.nextNode.nextNode;

}

This code removes the node after the current entry. Again, to remove the current node instead of the one following, you would move the data from nextNode into the current node, then delete nextNode.

In a modern programming language, the old node will be garbage collected after a period of time, thus reclaiming the memory used. In other languages, you would need to "free" or "delete" the ListNode that was contained in CurrentNode.nextNode.

Student database using linked singly linked list?

/*Title : Creating Student Database Using Singly linked list */

#include<stdio.h>

#include<conio.h>

struct Student

{

int roll;

char name[30];

float marks;

struct Student *next; //Self referential pointer...

};

typedef struct Student Node;

void Linkfloat()

{

float a=0,*b; //To create link of float to some compiler ...

b=&a;

a=*b;

}

void Display(Node *head)

{

Node *p;

int i;

if(head==NULL)

{

printf("

There is no records in database.

");

}

else

{

p=head;

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

{

printf("-");

}

printf("

Updated Student Database

");

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

{

printf("-");

}

printf("

");

printf("Roll No. Name Marks

");

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

{

printf("-");

}

printf("

");

while(p!=NULL)

{

printf("%d %s %0.2f",p->roll,p->name,p->marks);

printf("

");

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

{

printf("-");

}

printf("

");

flushall();

p=p->next; //Go to next node...

}

}

}

void DReverse(Node * head)

{

Node *p;

int i;

if(head==NULL)

{

printf("

There is no records in database.

");

}

else

{

p=head;

if(p->next!=NULL)

{

DReverse(p->next); //Recursive call...

}

printf("%d %s %0.2f",p->roll,p->name,p->marks);

printf("

");

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

{

printf("-");

}

printf("

");

flushall();

printf("

");

}

}

Node* Create(Node *head)

{

int n,i;

Node *nn,*p;

printf("

How many Entries to Create Database???

");

scanf("%d",&n);

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

{

if(head==NULL)

{

nn=(Node*)malloc(sizeof(Node)); //Creating first node...

printf("

Enter Roll No. , Name & Marks

");

scanf("%d",&(nn->roll));

flushall();

gets(nn->name);

scanf("%f",&(nn->marks));

nn->next=NULL; //Set next to NULL...

head=nn;

}

else

{

p=nn=head;

while(nn->next!=NULL)

{

nn=nn->next;

}

nn->next=(Node*)malloc(sizeof(Node)); //Creating further nodes...

nn=nn->next;

printf("

Enter Roll NO.,Name & Marks

");

scanf("%d",&(nn->roll));

flushall();

gets(nn->name);

scanf("%f",&(nn->marks));

nn->next=NULL;

nn=p;

}

}

return head;

}

Node* Insert(Node *head)

{

int ch,r;

char ans;

Node *p,*nn,*q;

do

{

printf("

Whwre do you want to enter new entry???

");

printf("

1.At the Begining

2.At the middle

3.At the end

");

printf("

Enter your choice:

");

scanf("%d",&ch);

switch(ch)

{

case 1:

/* Insert at Begining */

p=head;

nn=(Node*)malloc(sizeof(Node));

printf("

Enter Roll NO., Name & Marks

");

scanf("%d",&(nn->roll));

flushall();

gets(nn->name);

scanf("%f",&(nn->marks));

nn->next=NULL;

nn->next=p;

head=nn; //set first node as head...

printf("

Entry is Created successfully.

");

Display(head);

break;

case 2:

/* Insert at Middle */

if(head==NULL)

{

printf("

Yet database is not created.");

printf("

Database is empty.

");

printf("

First Create Database.

");

}

else

{

printf("

After which Roll NO. You want to insert new Data???

");

scanf("%d",&r);

p=head;

while(p->roll!=r && p->next!=NULL)

{

p=p->next; //Go upto that roll no....

}

if(p->roll!=r)

{

printf("

There is no such entry.

");

}

else

{

nn=(Node*)malloc(sizeof(Node));

printf("

Enter Roll NO.,Name & Marks

");

scanf("%d",&(nn->roll));

flushall();

gets(nn->name);

scanf("%f",&(nn->marks));

nn->next=NULL;

q=p->next;

p->next=nn;

nn->next=q;

printf("

Entry is Created successfully.

");

Display(head);

}

}

break;

case 3:

/* Insert at end */

if(head==NULL)

{

printf("

Yet database is not created.");

printf("

Database is empty.

");

printf("

First Create Database.

");

}

else

{

p=head;

nn=(Node*)malloc(sizeof(Node));

printf("

Enter Roll NO.,Name & Marks

");

scanf("%d",&(nn->roll));

flushall();

gets(nn->name);

scanf("%f",&(nn->marks));

nn->next=NULL;

while(p->next!=NULL)

{

p=p->next; //Go upto last node...

}

p->next=nn;

printf("

Entry is Created successfully.

");

Display(head);

}

break;

}

printf("

Do you want to Insert more data(Y/N)???");

flushall();

scanf("%c",&ans);

}while(ans=='y' ans=='Y');

return head;

}

Node* Delete(Node* head)

{

Node *p,*q,*r;

char ans;

int ch,n;

do{

printf("

Which Entry you want to Delete???

");

printf("

1.First

2.Middle

3.End

");

scanf("%d",&ch);

if(head==NULL)

{

printf("

Yet database is not created.");

printf("

Database is empty.

");

printf("

First Create Database.

");

}

else

{

switch(ch)

{

case 1:

/*Delete first node */

p=head;

head=head->next; //Set second node as head...

free(p);

printf("

First entry is deleted.

");

Display(head);

break;

case 2:

/*Delete middle Node*/

p=head;

printf("

Enter roll no. which you want to delete:

");

scanf("%d",&n);

while((p->next)->roll!=n && p->next->next!=NULL)

{

p=p->next; //Go upto -1 node which you want to delete...

}

if(p->next->next==NULL)

{

printf("

There is no such entry.

");

}

else

{

q=p->next;

r=q->next;

p->next=r;

free(q); //Delete that node...

printf("

Entry is deleted.

");

Display(head);

}

break;

case 3:

/* Delete last node */

p=head;

while(p->next->next!=NULL)

{

p=p->next; //Go upto -1 node which you want to delete...

}

q=p->next;

free(q); //Delete last node...

p->next=NULL;

printf("

Last entry is deleted.

");

Display(head);

break;

}

}

printf("

Do you want to delete more data(Y/N)???

");

flushall();

scanf("%c",&ans);

}while(ans=='y' ans=='Y');

return head;

}

Search(Node *head)

{

Node *p;

int r,cnt=0;

if(head==NULL)

{

printf("

Yet database is not created.");

printf("

Database is empty.

");

printf("

First Create Database.

");

}

else

{

p=head;

printf("

Enter roll no. which you want to Search:

");

scanf("%d",&r);

while(p->roll!=r && p->next!=NULL) //Search for roll no...

{

p=p->next;

cnt++;

}

if(p->roll!=r)

printf("

There is no such entry.

");

else

{

printf("

Roll NO. %d is at %d th Position.",r,(cnt+1));

printf("

Roll No. Name Marks

");

printf("%d %s %0.2f",p->roll,p->name,p->marks);

}

}

}

Modify(Node * head)

{

Node *p;

int r;

if(head==NULL)

{

printf("

Yet database is not created.");

printf("

Database is empty.

");

printf("

First Create Database.

");

}

else

{

p=head;

printf("

Enter the Roll no. whose data you want to modify:

");

scanf("%d",&r);

while(p->roll!=r && p->next!=NULL)

{

p=p->next;

}

if(p->roll!=r)

{

printf("

Thre is no such record in Database.

");

}

else

{

printf("

Entered roll no's Data is:

");

printf("Roll No. Name Marks

"); //Displaying Data who is going to modify....

printf("%d %s %f",p->roll,p->name,p->marks);

printf("

Enter New roll no ,New name & Marks for this entry:

");

scanf("%d",&p->roll);

flushall();

gets(p->name); //Enter new data...

scanf("%f",&(p->marks));

printf("

Entered New Data is:

");

printf("Roll No. Name Marks

");

printf("%d %s %f",p->roll,p->name,p->marks);

Display(head);

}

}

}

Count(Node *head)

{

Node *p;

int cnt=0;

if(head==NULL)

{

printf("

Yet database is not created.");

printf("

Database is empty.

");

printf("

First Create Database.

");

printf("

There are 0 records in Database.

");

}

else

{

p=head;

while(p->next!=NULL)

{

p=p->next;

cnt++; //Counting records...

}

printf("

There are %d records in Database.

",(cnt+1));

}

}

void main()

{

int ch,i;

char op;

Node *head;

head=NULL;

printf("

*----------Studednt Database-----------*

");

do

{

printf("

Menu

1.Create Database

2.Insert

3.Delete

4.Search

5.Modify

6.Display

7.Display Reverse

8.Count Records

9.Exit

");

printf("

Enter your choice

");

scanf("%d",&ch);

switch(ch)

{

case 1:

head=Create(head); //Call to Create...

break;

case 2:

head=Insert(head); //Call to Insert...

break;

case 3:

head=Delete(head); //Call to Delete...

break;

case 4:

Search(head); //Call to Search...

break;

case 5:

Modify(head); //Call to Modify...

break;

case 6:

Display(head); //Call to Display...

break;

case 7:

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

{

printf("-");

}

printf("

Updated Student Database

");

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

{

printf("-");

}

printf("

");

printf("Roll No. Name Marks

");

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

{

printf("-");

}

printf("

");

DReverse(head); //Call to displaying reversre...

break;

case 8:

Count(head); //Call to counting records...

break;

case 9:

exit(); //Exit...

default :

printf("

You entered wrong choice.

");

}

printf("

Do you want to Exit(Y/N)???

");

flushall();

scanf("%c",&op);

}while(op=='n' op=='N');

}

How do you implement a doubly linked list by using singly linked list?

Add another pointer to the nodes for the previous node:

struct node {

struct node *next;

struct node *previous;

void *data;

};

typedef struct node node;

Then change the logic for insertion and removal to make sure you set the previous pointer as well as the next one.

What is heterogeneous linked list?

Heterogeneous Linked List is a linked list data-structure that contains or is capable of storing data for different datatypes.

void pointer is basically used in these types of linked list as we are not sure of which type of data needs to be stored

Give 10 difference between dda and bresenham algorithm?

  1. DDA algorithm involves floating-point operations, while Bresenham algorithm uses only integer operations.
  2. DDA algorithm calculates the exact position of each pixel, while Bresenham algorithm determines the closest pixel to the ideal line path.
  3. DDA algorithm can suffer from precision issues due to floating-point calculations, while Bresenham algorithm is more accurate and efficient.
  4. DDA algorithm is simpler to implement but slower than Bresenham algorithm.
  5. DDA algorithm is susceptible to rounding errors, while Bresenham algorithm is not.
  6. DDA algorithm can produce jagged lines due to rounding errors, while Bresenham algorithm generates smoother lines.
  7. DDA algorithm is suitable for both lines and circles, while Bresenham algorithm is primarily used for drawing lines.
  8. DDA algorithm can handle lines with any slope, while Bresenham algorithm is more efficient for lines with slopes close to 0 or 1.
  9. DDA algorithm involves multiplication and division operations, while Bresenham algorithm uses addition and subtraction operations.
  10. DDA algorithm is a general line drawing algorithm, while Bresenham algorithm is specialized for line drawing and rasterization.

What is the difference between doubly linked list and circular linked list?

A doubly linked list is a linked list in which each node knows where both of its neighbors are.

A circular linked list is a linked list in which the "tail" of the list is linked to the "root". (Note that both the tail and root of the list are undefined/arbitrary in a circular linked list)

Doubly linked lists are actually not necessarily related to circular linked list (aside from both being based on a linked list structure). In fact, you can have a circular doubly linked list, where each node knows where both of its neighbors are andwhere the list wraps around to connect to itself.

What are examples of pattern recognition?

Examples of pattern recognition include detecting faces in images, identifying fraudulent behavior in financial transactions, and recognizing speech in audio recordings. These tasks involve recognizing consistent and repeating patterns within data to make accurate predictions or classifications.