answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

What are social variables?

Social variables are those aspects of a person which may well impact on the way in which they answer a question, speak a language's dialect, what accent they have, where they shop, their politics, etc...

Generally speaking Social Scientists insist on "controlling for" (taking account of) the social variables of respondents in order to ensure that their test results and responses from any study's participants are 'valid'

Generally, social variables include (but are not limited to):

-Gender

-Age

-Social class

-Region of origin

-Region of residence

-Occupation

-Salary/income range

-etc...

The reason we Social Scientists control for these variables is that if you were to ask 100 random people whether pre-marital sexual activity was acceptable and of those asked 90 were lower-middle class university students who happened to be male, and the other 10 were female church members for the mid-west of the US, then you're going to get VERY skewed results which would, essentially, invalidate your study.

What is better strcpy or memcpy?

They do different things, so they are uncomparable.

PS: strcpy can be implemented with strlen+memcpy:

char *strcpy (char *dest, const char *src)

{

size_t len;

len= strlen (src);

memcpy (dest, src, len);

return dest;

}

Who is the protagonist in the story all the years of her life?

the proitagonist in the story is Mrs. Higgins.... you could realize by the title... the protagonist is Alfred - he is the one with the decision to make, and he is the one who is profoundly changed by the end of the story.

Gray code of 111 is?

Gray code is a 'reflected code', why is it named so will be illustrated soon. The advantage of Gray code over binary code is that only one bit in the code group changes when going from one number to the next. By, Ashish Kumar (Roh, Nawada, Bihar)

Is prototyping mandatory in c?

Prototyping is optional in C, though highly recommended.

What is the instruction set to multiply to positive numbers together using Little Man Computer...I'm going insane trying to figure this out?

you can't multiply on LMC you can only add numbers so you have to add the same number as many times as you need to multiply example 5 times 3 5+5+5

What happens to child thread when you delete main thread during run-time?

In Java, if the main thread somehow exits then all other threads will stop executing. This generally does not happen, as the main thread will wait for all child threads to terminate before the main thread itself finishes. Interrupting this process is hard to do short of an un-handled exception or a call to System.exit.

If the child thread is also a daemon thread, then the child thread will continue to execute. If the child thread is a normal thread then, the moment System.exit is called, the child thread also terminates

If you call the join() method from the child thread, then the main thread will wait until the child is over before executing the System.exit

Write algorithm to delete last node in circular linked list?

This depends on whether the list is singly or doubly(or multiply) linked, and on the actual implementation of the list. For example, you can write a CDLL(circular doubly linked list) without maintaining your beginning or ending nodes, using only a current pointer, thus this question doesn't really apply as there would be no "last" node and thus it would be like deleting any node.

A typical implementation of a circular singly-linked list (CSLL) list actually maintains the pointer to the last element (hence it's FIFO nature) and thus there are both last and first nodes.

This deletion is a little tricky. Consider that you have situations where the next pointer will point to the current element. On the other hand, you also have a situation where there are n-values that you have to iterate over to find the next-to-last value. Typically you would delete the first node in these lists, again dictated by the FIFO nature of these lists, but deletion of the last node is also not impossible.

set struct node *last to list->end

if (list->end->next == list->end){

set list->end to null (leaving an empty list)

} else {

while(true){

if(last->next == list->end){

break

}

set last to last->next

}

set link->last to list->end->next (this temporarily sets list's end node to current first node)

free last->next (frees the last node)

set last->next to list->end (set the new last node next pointer to the first node)

set list->end to last (set the list's end node to the new last node)

}

What is macro operations?

Macro operations are those not linked to individual types and invoked on objetcs - but rather general operations associated with the database as a whole.

How many bytes are found in page of memory?

The answer is largely O/S and architecture specific, though 4KB and 8KB pages sizes are probably the most common.

What kind of bugs are you more likely to find with black box testing vs glass box testing?

You run Black box Test when you make integration test. This means you have input and output.

You will therefore see that certain input may not match your expected output.

To solve this use Boundary Value Analysis to find out what to values gives what result.

Do dangling references and garbage ever arise in the same programming language?

Dangling references and garbage, otherwise known as memory leaks, can occur in the same application and programming language. These symptoms are evidence of sloppy memory management by the programmer.

Dangling references and garbage collection cannot normally occur at the same time, as the garbage collector is not supposed to discard an item so long as there are still any references to it. Therefore, a reference can never "dangle" (i.e. refer to a no longer existing item).

What does hover mean?

"Hover" means to hang fluttering in the air on on the wing, to remain suspended over a place or object, to move to and fro near a place, or to be in a state of uncertainty, irresolution, or suspense (as a hen hovers about her chicks - brooding over).

How super class variable can be used to refer the sub class object?

The super variable is not a reference to a subclass. It is a reference to the superclass.

class MyClass {

void printType() {

System.out.println("This is a MyClass");

}

// MySubClass is a subclass of MyClass. Within this class, the super keyword

// refers to MyClass.

static class MySubClass extends MyClass {

void printType() {

// Tell Java we also want to call the printType method of the super class

super.printType();

System.out.println("This is a MySubClass");

}

}

}

How do you write assembly programs for PIC Microcontroller 18f458?

By using the appropriate programmer for the chip. See related links for the MPLAB PM3 Universal Device Programmer.

What is ddl explanation?

ddl stands for Data Definaton Language.Eg:- Create ,Alter .Drop.Truncate

Why we have called it as DDL means.... we are defining or acting at structure level. Say, when ever you create a table we are dealing at strucutre level. Hence its is DDL

What is the difference between bubble sort and selection sort in pascal?

The traditional bubble sort moves any number of elements at most one position per iteration, while selection sort moves exactly one element per iteration. Both sorts require an exponential amount of time to produce their results.

What is deleting a node?

deleting a node is nothing but changing the addresses in the previous and next nodes and establishing a connection btn them