answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

Which information about a job needs to be kept in the pcb?

LOL! I think were in the same class!

information about the current status and characteristics of a process.

What does language is dynamic mean?

Computer programming languages change from generation to generation due to changes (advancements) in computer hardware. The general trend is languages are becoming more human-like as computer capabilities continue to improve.

Programming to calculate a factorial number?

double factorial(double N)

{

double total = 1;

while (N > 1)

{

total *= N;

N--;

}

return total; // We are returning the value in variable title total

//return factorial;

}

int main()

{

double myNumber = 0;

cout << "Enter the number: ";

cin >> myNumber;

cout << endl << "Factorial of N is: " << factorial(myNumber);

return 0;

}

Write a Fibonacci function then takes an input from the user in main program and pass to function which prints Fibonacci series up to this number using function in c plus plus language?

We use long int or long instead of int as for larger terms the number is also larger.

Code is as follows:

#include

#include

long fib(long n);

void main()

{

long res,n;

int i;

printf("Enter the number of terms of the Fibonacci Series:\t");

scanf("%d",&n);

for(i=0;i

{

res=fib(i);

printf("\n %d",res);

}

_getch();

}

long fib(long n)

{

long res;

if(n==0n==1)

return (n);

else

res=fib(n-1)+fib(n-2);

return(res);

}

How many pointers can be used in a c program?

Answergenerally we use simple pointer, void pointer,null pointer, structure pointer. Answerzero or more (unlimited).

Difference between deterministic and nondeterministic algorithm in design and analysis of algorithm?

Algorithm is deterministic if for a given input the output generated is same for a function. A mathematical function is deterministic. Hence the state is known at every step of the algorithm.Algorithm is non deterministic if there are more than one path the algorithm can take. Due to this, one cannot determine the next state of the machine running the algorithm. Example would be a random function.FYI,Non deterministic machines that can't solve problems in polynomial time are NP. Hence finding a solution to an NP problem is hard but verifying it can be done in polynomial time. Hope this helps.Pl correct me if I am wrong here.Thank you.Sharada

What does a assembly language code look like?

Machine language is all binary numbers, and will vary on different architectures. For example, on a 32 bit processor, instructions will come in the form of a sequence of 32 "1"s or "0"s, where maybe the first 5 tell the CPU which instruction is being performed (add, subtract, load memory into register, load register into memory, etc), if you are adding maybe the next 5 bits means register $eax, the next 5 bits could be register $ebx.

The actual instruction will look something like: 01101001011010001100110011001100

Why is a just-in -time compiler useful for executing Java programs?

I'm not sure if it's "useful" as much as it is the fact of it being how the Java compiler works.

However, there's a GCC frontend for compiling Java to native machine code rather than bytecode.

Example of immersive multimedia in education?

I am a major Athlon fan, every computer I've every purchased on my own has ran athlon, or duron, thunderbird, or anything but Intel. That is my personal opinion, i have used Intel in the past, and i am very unsatisfied, especially with Dell. Like right now i have a AMD Athlon 64 Processor 3200+, 2.01 GHz, L1: 64KB L2: 512KB, and i love it, wouldn't use anything else. Remember this is only my personal opinion.. good luck :)

What is the binary code for 4?

14 decimal in binary is 11102. In octal it is 168 and in hexadecimal it is 0E16.

What is are advatages and disadvatages of bresenham's line algorithm?

1. High accuracy. Comparing to Basic Incremental algorithm (especially if the slope were > 1.) 2. High speed. Comparing to Digital Differenmtial algorithm. 3. Draws the line between any two points. Comparing to Basic Incremental algorithm which can't draw if x0 > x1 ( the format is: (x0, y0), (x1, y1). )

How many programming languages does the average computer scientist know?

Humans do not write programs using computer language (machine code) we use symbolic programming languages. This wasn't always the case, of course, but humans were speaking "human language" long before we learned to program computers. Without that simple ability we wouldn't be able to communicate with each other let alone invent a programmable machine.

How many seconds are there in 35 years?

2759400000

--------------- original answer above is way too big, improved below -----------

There are 36 possible answers,

depends on how many leap years in those 35 years,

starting the normal 35 years (no leap years):

60 * 60 * 24 = 86400 seconds/day

86400 * 365 * 35 = 1103760000 seconds / normal year

for 1 leap years in those 35 : 1103760000 + 86400 = 1103846400

for 2 : 1103760000 + 86400 * 2

for 3 : 1103760000 + 86400 * 3

...

for 35 leap days: 1103760000 + 86400 * 35 = 1106764000

so, the answer is between [1103760000,1106764000]

How c language convert into machine language?

With a compiler, which is a program that "knows" how to transform the programming language logic in to machine code and make it perform from that.

What is the advantage of circular queue over simple queue?

Circular queue have less memory consuption as compared to linear queue because while doing insertion after deletion operation it allocate an extra space the first remaining vacant but in circular queue the first is used as it comes immediate after the last.

Why a machine language required?

no it can also understand person langugage

pretty tricky huh

lol

With data structures what are the implementations of using LIFO and FIFO?

Think about what each concept means.

A FIFO (First In, First Out) stack is like a supermarket queue - people are served in the order in which they arrive in line. You'd use a FIFO stack for a process that requires sequential access to data in arrival order, such as transaction processing.

On the other hand, a LIFO (Last In, First Out) stack is like an elevator - the people who board last are nearest the front, so they're the first off in "processing" order. You might use a LIFO stack for something like expression parsing. For example, if you're trying to match up parens, you need to use the "nearest match" rule. That means if you have already stacked two "("s you'd want to pair the most recently-scanned one with the first closing ")" encountered and evaluate the enclosed expression. That means the ")" would pair off with the "(" at the top of your paren stack rather than the bottom; i.e. LIFO.

797326161 bytes to MB?

2 MB

1024 byte = 1 KB
1024 KB = 1 MB
1024 MB = 1 GB
1024 GB = 1 TB

and so on...

Write a program in c plus plus in which insertion and deletion in an array?

#include<stdio.h>

#include<conio.h>

void main()

{

int a[10],i,j,k,n;

printf("enter number of elements of array");

scanf("%d",n);

printf("Enter array elements");

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

{

scanf("%d",a[i]);

}

printf("enter the element you want to delete");

scanf("%d",k);

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

{

if(a[j]==k)

{

a[j]=a[j+1];

n=n-1;

}

}

printf("The array after deletion of %d is:",k);

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

{

printf("%d",a[i]);

}

getch();

}

Write a program to accept any number n print the qube of all the number from 1 to n that are divisible by 3?

# Ruby code

print 'Enter n: '; n = gets.to_i

n.times { | i |

puts ( i + 1 ) ** 2 if ( i + 1 ) % 3.0 == 0.0

}