answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

Why does a computer understand only machine language?

Yes. It only knows of binary. Stuff like 100101010010101010101.

There is a study called Natural Language Processing (NLP) that is a study about how to help the computer understand human languages. The techniques used in the algorithms are still however converted into binary which a computer can understand...so really, anybody researching and making the next generation technology is making the brain of the computer.

To make a not-so-great analogy, a normal human can hear, see, touch, etc...but they won't know they are performing these actions unless the brain knows it is...

It's like NLP is giving the computer a brain. Not at all a perfect analogy but you should get the idea.

Write a program to generate the sequence?

#include<math.h> main()

{

int s=1,n,x,i;

clrscr();

printf("enter value of n");

scanf("%d",&n);

printf("enter value of x");

scanf("%d",&x);

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

{

s=pow(x,i);

}

printf("sum of series=%d",s);

getch();

}

Explain the lru algorithm from the page replacement algorithm?

First In First Out (FIFO) – This is the simplest page replacement algorithm. ...

Optimal Page replacement – In this algorithm, pages are replaced which would not be used for the longest duration of time in the future. ...

Least Recently Used – In this algorithm page will be replaced which is least recently used.First In First Out (FIFO) – This is the simplest page replacement algorithm. ...

Optimal Page replacement – In this algorithm, pages are replaced which would not be used for the longest duration of time in the future. ...

Least Recently Used – In this algorithm page will be replaced which is least recently used.

How do you convert higher level language into lower level language?

Not only can we but we have to! Machine code is the only language understood by the computer, thus all languages, both low and high level, must be converted to machine code in order to execute. Most compiled languages can produce low-level symbolic code (assembly language), but not all, especially those that compile to byte code rather than machine code. However, all code has to be compiled or interpreted to machine code at some point and machine code can be disassembled to produce low-level symbolic code.

What is a high level of attention?

The term 'attention' is used to describe the process of focusing on one or more specific stimuli (meaning something that activates our senses) while ignoring other stimuli that may be present. Attention may be paid to internal stimuli such as thoughts, feelings and memories, or to external stimuli such as sights, sounds or smells. individuals have the ability to choose to focus a high level of attention on a particular stimulus, such as listening to a news item. psychologists call this selective attention. individuals also have the ability to divide their attention between two or more sources of information, such as hearing the phone ring while talking to someone. psychologists call this divided attention.

hope that helps :)

How high is a cricket wicket?

The top of the stump should be 28 in/71.1cm above the playing surface according to the laws of cricket. (Rajaram S from www.srajaram.com)

What is the process of writing specific instructions in computer language called?

A machine code program. Machine code is the native language of the machine and the only language actually understood by the machine. However, program instructions can be written using a high-level programming language that the computer can translate into machine code using another machine code program called a compiler.

Difference between computer application and computer science?

Answer

An application is a program in general, for instance, Internet Explorer, Microsoft Word and Notepad.

A process is single instance of an application whilst it is running.

Is stack a linear data structure?

Yes. All object on a stack must be of the same type. However, the type may be a base class in which case all objects on the stack must either be of that type or be derived from that type. That is, if a circle, triangle and rectangle class are all derived from a common shape class, a stack of shapes would allow instances of all four types because they are all a type of shape.

Different types of pointers in c language?

... are usable.

void pointer (generic pointer) : a special type of pointer which point to some data

of no specific types.

void *p;

null pointer : a special type of pointer which point nowhere.

it is usually used to check if a pointer is pointing to a null or free

the pointer during deallocation of memory in dynamic memory allocation;

it is define by using the predefine constant NULL

int *p=NULL;

wild pointer : uninitialized pointer. it hold a garbage value. i.e it is not pointing to

any memory location yet.

dangling pointer: pointer pointing to a destroyed variable.

it usually happen during dynamic memory allocation when the

object is destroyed but not free and the pointer is still pointing

to the destroy object.

Why is the if statement useful?

if statements allows for human-readable, logical branches in code. While usually not the only control statements in programming languages, they provide both a simple and a powerful method to allow code to divert off of a preset path.

What is CSharp?

The C# sharp programming language is a relatively young programming language created by Microsoft. It is heavily influenced by another (and older) programming language called C++, which in itself is often regarded as a succesor to the programming language C. As far to my knowledge C# is only used in order to develop .NET based applications.

Explain binary coded decimal?

Binary Coded Decimal (BCD) is a set of coding systems for storing decimal digits in binary code. There are several such codes, I will give examples of 3: straight BCD, XS3 BCD, and 2 of 5 BCD.

Straight BCD uses the actual binary value of the decimal digit value:

0 = 0000

1 = 0001

2 = 0010

3 = 0011

4 = 0100

5 = 0101

6 = 0110

7 = 0111

8 = 1000

9 = 1001

XS3 BCD adds 3 to the binary value of the decimal digit value to make the code:

0 = 0011

1 = 0100

2 = 0101

3 = 0110

4 = 0111

5 = 1000

6 = 1001

7 = 1010

8 = 1011

9 = 1100

2 of 5 BCD uses a 5 bit code where only 2 bits can be on in a decimal digit's code:

0 = 00011

1 = 11000

2 = 10100

3 = 10010

4 = 10001

5 = 01100

6 = 01010

7 = 01001

8 = 00110

9 = 00101

What is structured analysis all about?

Structured analysis is a set of techniques and graphical tools used by the analyst for applying a systematic approach to systems analysis. The traditional approach focuses on cost/benefit and feasibility analyses, project management, hardware and software selection, and personnel considerations. In contrast, structured analysis uses graphical tools such as Data Flow diagram, data dictionary, structured English, Decision tree, and decision tables. The outcome of structured analysis is a new document, called system specifications, which provides the basis for design and implementation. The primary steps included in structured analysis are: 1. Study affected user areas, resulting in a physical DFD. The logical equivalent of the present system results in a logical DFD. 2. Remove the physical checkpoints and replace them with a logical equivalent, resulting in the logical DFD. 3. Model new logical system 4. Establish man/machine interface 5. Quantify costs and benefits and select hardware. The structured specification consists of the DFDs that show the major decomposition of system functions and their interfaces, the data dictionary documenting all interface flows and data stores on the DFDs, and documentation of the intervals of DFDs through structured English, decision trees, and decision tables.

What are the disadvantages of using mail merge?

Advantages:

It is quick and easy.

It saves time.

You can address a large number of letters without having to do it yourself as mail merge inserts it for you.

Disadvantages:

It can be used as a scam.

It runs slowly or doesn't run at all when more than one software is running.

If it is email merge all recipients will be able to view all data and information.

How do you convert a number that consist of alphabet and number in reverse order?

To reverse a number, first convert the number to a string, then reverse the string. Given your number consists of alphanumeric characters, the number must already be a string so simply reverse the string:

#include<string>

using std::string;

string reverse (const string& s) {

string str {};

for (auto c : s) str.insert (str.begin(), c);

return str;

}

int main () {

std::cout << "Enter a number: ";

string s {};

std::cin >> s;

std::cout << "The number in reverse is: " << reverse (s);

}

Write an assembly language program to find the largest number from the given ten numbers?

org 100h

L2: mov bh,x(si)

mov ah, x(si)

L1:

cmp si,7

je L

inc si

cmp ah, x(si)

jg L1

jl L2

L:ret

x db 1,3,7,8,6,9,5

How do you write pseudo-code?

However you want!

Pseudo code is not a well defined programming language. The idea is to write something that looks like code, but doesn't necessarily have to run in any specific language.

For example, you could write:

for all values in some_array:

if value is empty:

fill value

without defining at this point what exactly it means for a value to be empty, or how to fill a value.

What is the best programming language to make an MMORPG with?

There are many options; the best language is probably the one you know best. Some languages may be better than others, but no language is inherently superior to all others, whether you want to make an MMORPG, or any other task.

Which is the unary operator used to dereference a pointer and return the value stored in it?

The asterisk (*) operator dereferences a pointer and returns the value stored in the memory pointed to by the pointer.

Advantages of problem analysis and algorithm design over directly writing program in high-level language?

It is much easier to discover errors in a program that is well analyzed and well designed. Furthermore, a thoroughly analyzed and carefully designed program is much easier to follow and modify.Even the most experienced programmers spend a considerable amount of time analyzing a problem and designing an algorithm

Program to find roots of quadratic equation using switch?

include <stdio.h>

#include <math.h>

/* Prototypes */

void realRoots(double, double, double);

void imaginaryRoots(double, double, double);

int main() {

/* Local variables */

int option;

double a, b, c, d;

printf(" Quadratic Equation ax^2+bx+c=0 \n");

printf("******************* *******************\n");

/* Print list */

printf("\n1) Real roots\n");

printf("2) Imaginary roots\n");

printf("3) Repeated roots\n");

printf("4) Exit\n");

scanf("%d", &option);

printf("************* *************************\n");

/* Get a, b, and c from user */

printf("\na = ");

scanf("%lf", &a);

printf("b = ");

scanf("%lf", &b);

printf("c = ");

scanf("%lf", &c);

/* Calculate determinant */

d = (b * b) - (4 * a * c);

/* Use switch statement */

switch(option) {

/* If 1 was selected */

case 1:

realRoots(a, b, sqrt(d));

break;

/* If 2 was selected */

case 2:

imaginaryRoots(a, b, sqrt(-d));

break;

/* If 3 was selected */

case 3:

break;

/* If 4 was selected */

case 4:

break;

}

/* End program */

return 0;

}

/* Evaluate real roots */

void realRoots(double a, double b, double d) {

/* Calculate */

double firstRoot = (-b/(2 * a)) + (d/(2 * a));

double secondRoot = (-b/(2 * a)) - (d/(2 * a));

/* Print */

printf("\nFirst Real Root: \t%lf\n", firstRoot);

printf("\nSecond Real Root: \t%lf\n", secondRoot);

}

/* Evaluate imaginary roots */

void imaginaryRoots(double a, double b, double d) {

/* Calculate */

double x = 2 * a;

double first_term = (-b)/x;

double second_term = (d)/x;

/* Print */

if(second_term >= 0) {

printf("\nFirst Imaginary Root: \t%lf + %lfi\n", first_term, second_term);

printf("\nSecond Imaginary Root: \t%lf - %lfi\n", first_term, second_term);

}else {

second_term = -(second_term);

printf("\nFirst Imaginary Root: \t%lf + %lfi\n", first_term, second_term);

printf("\nSecond Imaginary Root: \t%lf - %lfi\n", first_term, second_term);

}

}