answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

How many hours of course study is a masters degree in information technology?

A masters within this field of study - in total - can range between 33-40 credit hours depending on the specific college or university curriculum layout. It usually takes a student two to three years to complete depending on the credit load carried each semester, personal work/life responsibilities, and/or whether it is taken as an accelerated program (which some institutions offer).

In a computer most processing takes place in?

This answer would be the CPU (Central Processing Unit).

Program in java to add two numbers?

import javax.swing.JOptionPane;

public class Addition

{

public static void main( String args[] )

{

String firstNumber =

JOptionPane.showInputDialog( "Enter first integer" );

String secondNumber =

JOptionPane.showInputDialog( "Enter second integer" );

int number1 = Integer.parseInt( firstNumber );

int number2 = Integer.parseInt( secondNumber );

int sum = number1 + number2;

JOptionPane.showMessageDialog( null, "The sum is " + sum,

"Sum of Two Integers", JOptionPane.PLAIN_MESSAGE );

}

}

Write a program of using recursion to create a table of any number?

/*mycfiles.wordpress.com

Program to prepare Table of any no. using while loop*/

#include

#include

void main()

{

int n,t,count=1;

clrscr();

printf("Enter any number\n\n");

scanf("%d",&n);

while(count<=10)

{

t=n*count;

printf("\n%d*%d=%d",n,count,t);

count++;

}

getch();

}

Difference between C and C Plus programming languages?

C++ allows you to mix object oriented programming with generic programming and C-style programming. C has none of these features.

C-style programming and C programming are broadly similar, with only minor differences, most of which are irrelevant. As such, it is very rarely necessary to use a lower-level language than C++.

The static type system in C is inherently weak; filled with loopholes and inconsistencies. C++ is much more robust by comparison.

What best explains the difference between a local and a global revision?

A local revision focuses on word choice and language; a global revision addresses organization and other larger elements.

C program to accept a string and search a character?

#include<stdio.h>

#include<conio.h>

int main()

{

char str[20],charsrc;

int i,j=0,re;

printf("Enter the string\n");

gets(str);

printf("Enter the character to be searched : ");

charsrc=getche();

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

{

if(charsrc==str[i])

{

re=i;

j=1;

}

}

if(j==1)

printf("Character is at position %d",re);

else

printf("Not found.");

return 0;

}

Why do global variables make a program difficult to debug?

The term variables imply that those things may be changed or assigned with new value (at numerous places). This make the program harder to debug because it will be difficult to know when and where a global variable being changed and what was the consequence of that value changed.

What is the input statement for a program?

Input statements extract data from an input stream. For example:

int x;

std::cin >> x;

Output statements insert data to an output stream. For example:

std::cout << x;

You cannot insert data into an input stream and cannot extract data from an output stream. However, streams that are both input and output streams (such as read-write files) can insert and extract data as required, depending on whether you are reading or writing to the stream.

Difference between simple queue and circular queue?

Simple queue is a linear queue having front & rear var to insert & delete elements from the list.But there is a boundary that we have to insert at rear & have delete from front.For this reason instead of having space in the queue if there is a single element in the rear,the queue is full.the other space is wasted.
To utilize space properly,circular queue is derived.In this queue the elements are inserted in circular manner.So that no space is wasted at all.

What is the difference between profiling and debugging?

Profiling is about executing a program and finding out how much time it spends in each routine. The goal of profiling is often finding slow routines in a program and optimizing them. Profiling is done on working code.

Debugging is about finding code that is not working, i.e. has some kind of defect. The program is known to have a defect because some set of inputs causes a set of outputs that are known to be wrong. Debugging is the process of finding the source of the defect in the code and fixing that location and any other downstream locations so that the set of inputs is correctly rendered into the set of outputs.

How important is Syntax in Excel?

Syntax is very important when writing Excel formulas. Each formula and function will help guide you through how to format the equation. Probably the most important thing to remember about syntax is to begin all formulas with the equal sign, or Excel will just interpret your entry as text and not calculate anything.

EXAMPLE: =SUM(A1:A12) [Adds the contents of cells A1 through A2]

Why do compiler writers need formal grammars?

Just as a person requires knowledge of the syntax (structure) and semantics (meaning) of a spoken language, so too does the compiler need to "understand" how to interpret what is being given to it. A formal grammar provides the rules of syntax and semantics.

Do can connect database with javascript?

You can't connect directly from a browser to the database, as the browser doesn't have access.
Even if you could, you shouldn't: If your Javascript sends SQL statements to the database, there is nothing stopping a random visitor from having fun by changing your SQL to "drop table", and your entire database is gone.

What you do is setting up a server side web service (using PHP, Java servlets, Ruby on Rails or whatever) that accepts a URL, converts it to a DB query and returns the result as JSON. The primary thing from a security standpoint is that you never insert a string from the web into the SQL without validating it first.

As an example, you could have something like this:

--- browser javascript (using jQuery) ---
$.getJSON("/productDetail.json?productId=123", function (data) {
// do something with the data
});

--- server (using Java servlet) ---
void doProductDetail(HttpServletRequest req, HttpServletResponse res) {
int productId = Integer.parseInt(...); // get product ID from query param
String sql = ...; // generate the SQL
String json = ...; // execute query, convert result to JSON
res.write(json); // send to browser
}

Write a python program to check a number is Armstrong number?

Unless someone is willing to write an entire program for you (which I would, but I don't have the patience to learn an entire new programming language to answer one question) I think the best you'll get is this:

  • To get user input: var = raw_input("Enter something: ")
  • To separate a number into its single digits: var = "your number"

    var2 = list(var) var2 will have what seems to be an array of each number.

  • foreach loops in Python are just: for "item" invar2: # do something with item such as cube it and add it to another variable set aside for the overall value. Or cube it and subtract it from the original and at the end check if what used to be the original is now zero.
  • Lastly, if it's in quotes you can change it.

Another way to do it (which would be easier but would probably take slightly longer and has a limit of number 10 digits or less) would be to check to see if the number is in the list in the related link.

I've been curious about Python before so if I end up getting to the point that I can write a simple program in it I'll add it to the related links.

How many vertices does an Triangle have?

A triangle has three sides and therefore three vertices, or angles.

Algorithm for implementing push operation on stack?

1. If TOP = MAXSTK THEN [Stack already filled?]

Print "OVERFLOW"

Go to step 4

Endif

2. TOP = TOP + 1 [Increase TOP by 1]

3. Set ST[STOP] = ITEM [Insert ITEM in new TOP position]

4. End

Write a program to print all the ASCII values and their equivalent characters using a while loop?

#include<stdio.h>

#include<conio.h>

void main()

{

int a=1;

while(a<=255)

{

printf("%d=%c",a,a );

a++;

}

getch();

}

Why you Use Memory Segmentation In 8086 Microprocessor?

The 8086/8088 is a 16 bit processor running on a 16 bit (8086) or 8 bit (8088) bus with a 20 bit address bus. In order to obtain the extra 4 bits of addressibility, Intel designed segment registers that are effectively multiplied by four and then added to the 16 bit offset address generated by the instruction. This yields 64K segments of 64KB each, although they overlap each other at a distance of 16 bytes.

Why C programming language can be used to solve different problem domain?

in case of the c languages we are very flexible to to solve the problems in the step by step order (because of using the c-functions,other variables,other operators),

debugging also so very easy because trace the exact steps which are given in the

problem domains.

What are advantages and disadvantages of linear programming LP?

Advantages of Linear Programming 1.The linear programming technique helps to make the best possible use of available productive resources (such as time, labour, machines etc.) 2. In a production process, bottle necks may occur. For example, in a factory some machines may be in great demand while others may lie idle for some time. A significant advantage of linear programming is highlighting of such bottle necks. Disadvantages of Linear Programming 1. Linear programming is applicable only to problems where the constraints and objective function are linear i.e., where they can be expressed as equations which represent straight lines. In real life situations, when constraints or objective functions are not linear, this technique cannot be used. 2. Factors such as uncertainty, weather conditions etc. are not taken into consideration.

Binary search using pointer in c?

#include
#include
#include
void main()
{
int a[10]={1,2,3,10,11,13,16,21,46,73};
int mid,lower=0,upper=9,num,flag=1;
clrscr();
printf("enter the number to search");
scanf("%d",&num);
printf("\n the list of the data is");
printf("%-20s","\ndata);
for(num=0;num<=upper;num++)
printf("%3d",a[num]);
printf("%-20s","\nindexno");
for(num=0;num<=upper;num++)
printf("%3d",num);
for(mid=(lower+upper)/2;lower<=upper;mid=(lower+upper)/2)
{
if(a[mid]==num)
{
printf("the number is at position %d in array",mid);
flag=0;
break;
}
if(a[mid]>num)
upper=mid-1;
else
lower=mid+1;
}
if(flag)
printf("element is not present in the array");
getch();
}