answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

What is The statements written by the programmer?

In languages that use a C-style syntax (e.g., C, C++ and Java) all code is written using expressions. Expressions may be combined to produce more complex expressions, however an expression or group of expressions only becomes a statement when terminated by a semi-colon. A group of statements enclosed by braces {} is known as a compound statement or code block.

Programming Logic and Design Fifth Edition solution manual?

Use single subscripted array(s) to solve the following problem. A company pays its sales people on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who grosses $3000 in sales in a week receives $200 plus 9% of $3000, or a total of $470. Design a program (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges.

  • $200-$299
  • $300-$399
  • $400-$499
  • $500-$599
  • $600-$699
  • $700-$799
  • $800-$899
  • $900-$999
  • $1000 and over

WRITE A Program to convert integar to hexadecimal in c language?

Use the %X modifier of printf.

Code Example:#include int main(void) { unsigned int iMyNumber = 255; printf("The number %u interpreted as hexadecimal is %X.\n", iMyNumber, iMyNumber); return 0; }

How do you make C plus plus Program Autorun?

This is not a C++ question. It is an operating system question. Different operating systems have different ways of making programs run on startup. Most of them have several different ways to accomplish this. In MS Windows, one way is to place a shortcut for the program in the "{percent}userprofile{percent}\Start Menu\Programs\Startup" shell folder.

What you mean by pure oops language?

An OOP language is an object oriented programming language. The plural is therefore OOP languages, not oops language.

A pure OOP language is one that does not have the concept of a primitive data type. That is, a data type that has no member methods whatsoever. In pure OOP languages, all primitive data types (pointers, characters, integers, floating point and array types) are implemented as objects that are associated with a default constructor, copy and move constructors, conversion constructors, copy and move assignment operators, type conversion operators and a destructor, all of which are members of the object's class.

Explain all the major types of documentation?

Documentation

· Software documentation or source code documentation is written text that accompanies computer software.

· It either explains how it operates or how to use it, and may mean different things to people in different roles.

Role of documentation in software developmentDocumentation is an important part of software engineering. Types of documentation include:

1. Requirements - Statements that identify attributes, capabilities, characteristics, or qualities of a system. This is the foundation for what shall be or has been implemented.

2. Architecture/Design - Overview of software. Includes relations to an environment and construction principles to be used in design of software components.

3. Technical - Documentation of code, algorithms, interfaces, and APIs.

4. End User - Manuals for the end-user, system administrators and support staff.

5. Marketing - How to market the product and analysis of the market demand.

Requirements documentationRequirements documentation is the description of what a particular software does or shall do. It is used throughout development to communicate what the software does or shall do. It is also used as an agreement or as the foundation for agreement on what the software shall do. Requirements are produced and consumed by everyone involved in the production of software: end users, customers, product managers, project managers, sales, marketing, software architects, usability engineers, interaction designers, developers, and testers, to name a few. Thus, requirements documentation has many different purposes.Requirements come in a variety of styles, notations and formality. Requirements can be goal-like (e.g., distributed work environment), close to design (e.g., builds can be started by right-clicking a configuration file and select the 'build' function), and anything in between. They can be specified as statements in natural language, as drawn figures, as detailed mathematical formulas, and as a combination of them all.The variation and complexity of requirements documentation makes it a proven challenge. Requirements may be implicit and hard to uncover. It is difficult to know exactly how much and what kind of documentation is needed and how much can be left to the architecture and design documentation, and). The need for requirements documentation is typically related to the complexity of the product, the impact of the product, and the life expectancy of the software. If the software is very complex or developed by many people (e.g., mobile phone software), requirements can help to better communicate what to achieve. Traditionally, requirements are specified in requirements documents (e.g. using word processing applications and spreadsheet applications). To manage the increased complexity and changing nature of requirements documentation (and software documentation in general), database-centric systems and special-purpose requirements management tools are advocated. Architecture/Design documentationArchitecture documentation is a special breed of design document. In a way, architecture documents are third derivative from the code (design document being second derivative, and code documents being first). Very little in the architecture documents is specific to the code itself. These documents do not describe how to program a particular routine, or even why that particular routine exists in the form that it does, but instead merely lays out the general requirements that would motivate the existence of such a routine. A good architecture document is short on details but thick on explanation. It may suggest approaches for lower level design, but leave the actual exploration trade studies to other documents.

A very important part of the design document in enterprise software development is the Database Design Document (DDD). It contains Conceptual, Logical, and Physical Design Elements. The DDD includes the formal information that the people who interact with the database need. The purpose of preparing it is to create a common source to be used by all players within the scene. The potential users are:

Database Designer;Database Developer;Database Administrator;Application Designer;Application Developer

When talking about Relational Database Systems, the document should include following parts:

· Entity - Relationship Schema (enhanced or not), including following information and their clear definitions:

o Entity Sets and their attributes

o Relationships and their attributes

o Candidate keys for each entity set

o Attribute and Tuple based constraints

· Relational Schema, including following information:

o Tables, Attributes, and their properties

o Views

o Constraints such as primary keys, foreign keys,

o Cardinality of referential constraints

o Cascading Policy for referential constraints

o Primary keys

Technical documentation

This is what most programmers mean when using the term software documentation. When creating software, code alone is insufficient. There must be some text along with it to describe various aspects of its intended operation. It is important for the code documents to be thorough, but not so verbose that it becomes difficult to maintain them. Several How-to and overview documentation are found specific to the software application or software product being documented by API Writers. This documentation may be used by developers, testers and also the end customers or clients using this software application. Today, we see lot of high end applications in the field of power, energy, transportation, networks, aerospace, safety, security, industry automation and a variety of other domains. Technical documentation has become important within such organizations as the basic and advanced level of information may change over a period of time with architecture changes. Hence, technical documentation has gained lot of importance in recent times, especially in the software field.

Often, tools such as Doxygen, NDoc, javadoc, EiffelStudio, Sandcastle, ROBODoc, POD, TwinText, or Universal Report can be used to auto-generate the code documents-that is, they extract the comments and software contracts, where available, from the source code and create reference manuals in such forms as text or HTML files. Code documents are often organized into a reference guide style, allowing a programmer to quickly look up an arbitrary function or class.

The idea of auto-generating documentation is attractive to programmers for various reasons. For example, because it is extracted from the source code itself (for example, through comments), the programmer can write it while referring to the code, and use the same tools used to create the source code to make the documentation. This makes it much easier to keep the documentation up-to-date.

User documentationUnlike code documents, user documents simply describe how a program is used.

In the case of a software library, the code documents and user documents could be effectively equivalent and are worth conjoining, but for a general application this is not often true.

Typically, the user documentation describes each feature of the program, and assists the user in realizing these features. A good user document can also go so far as to provide thorough troubleshooting assistance. It is very important for user documents to not be confusing, and for them to be up to date. User documents need not be organized in any particular way, but it is very important for them to have a through index. Consistency and simplicity are also very valuable. User documentation is considered to constitute a contract specifying what the software will do. API Writers are very well accomplished towards writing good user documents as they would be well aware of the software architecture and programming techniques used. See also Technical Writing.

There are three broad ways in which user documentation can be organized.

1. Tutorial: A tutorial approach is considered the most useful for a new user, in which they are guided through each step of accomplishing particular tasks.[1]

2. Thematic: A thematic approach, where chapters or sections concentrate on one particular area of interest, is of more general use to an intermediate user. Some authors prefer to convey their ideas through a knowledge based article to facilitating the user needs. This approach is usually practiced by a dynamic industry, such as Information technology, where the user population is largely correlated with the troubleshooting demands [2]

3. List or Reference: The final type of organizing principle is one in which commands or tasks are simply listed alphabetically or logically grouped, often via cross-referenced indexes. This latter approach is of greater use to advanced users who know exactly what sort of information they are looking for.

Marketing documentationFor many applications it is necessary to have some promotional materials to encourage casual observers to spend more time learning about the product. This form of documentation has three purposes:-

1. To excite the potential user about the product and instill in them a desire for becoming more involved with it.

2. To inform them about what exactly the product does, so that their expectations are in line with what they will be receiving.

3. To explain the position of this product with respect to other alternatives.

One good marketing technique is to provide clear and memorable catch phrases that exemplify the point we wish to convey, and also emphasize the interoperability of the program with anything else provided by the manufacturer.

Who invented the logo programming language?

That depends entirely on which definitions of "invent" and "programming language" you are using!

Countess Augusta Ada King (commonly known as Ada Lovelace), was history's first computer programmer. She took a great interest in Charles Babbage's design idea for a computer (which he called the Analytical Engine), and in 1843 she wrote a computer program to calculate Bernoulli Numbers, designed to run on Babbage's Engine. Although the Engine was never produced in either of their lifetimes, Lovelace's example program is preserved in her notes and, had Babbage finished the Engine, it would have executed perfectly. Therefore, Ada Lovelace was the first to find a method with which to write instructions that could be comprehended and executed by a computer. This is a common dictionary definition of a programming language, but it's not quite the same as a modern programming language.

During the 1940's, Konrad Zuse created the first working, program-controlled computer. Programs were read off punched tape. Zuse also designed the first high-level programming language, Plankalkül, but there was little interest in his papers and it wasn't implemented until the 1970's, decades after many other modern programming languages had been created.

After the computer was created, programmers used assembly language to write their instructions, but assembly is essentially machine code (binary) in a more human-readable format. Each computer had its own version of assembly, and most were built as part of a collaborative process within a company.

In 1953, John Backus proposed FORTRAN to his bosses at IBM. FORTRAN was the first modern programming language to be created and implemented; it was followed shortly by COBOL and LISP. FORTRAN might not be as fancy as some of the languages we have today, but it definitely has a lot in common with them. It included if statements, loops, basic mathematical operators, and file input/output. Later versions introduced data types, subroutines, and comments, to name a few.

Limang dimensyon sa pagbasa?

1.pag-unawang literal

2.pag-unawang ganap sa mga kaisipan ng may akda lakip ang mga karagdagang kahulugaan

3.pagkilatis sa kahalagahan ng mga kaisipan at ng kabisaan ng paglalahad

4.pagsanib ng mga kaisipang nabasa at ng mga karanasan upang magdulot ng bagong pananaw at pagkaunawa.

5.paglikha ng sariling kaisipang ayon sa mga kasanayan at kawilihan sa binasang seleksyon.

from:pabuhat feil James

What is the main idea of artificial intelligence?

We use Artificial Intelligence, or, AI, for multiple reasons. If we can find out more of AI, we could make a machine that could help us better in science and benefit the world.

  • Robots are still under development, and even though we have come close at times to a sufficiently working AI, it has yet to succeed, due to the sheer fact that we can learn over time, and do trial and error. Robots, in a sense, unless we create them that way, can not. They could either not learn from doing something like, if we pushed someone, they'll push him back, (if we did a robot-on-robot) but he won't learn to stop. That's the hardest part.
  • We use AIs to better our knowledge. Think about N.A.S.A. We didn't have to go to the moon, or even send satellites out there. But we did. Many people disagree with N.A.S.A. and their actions. If they knew how much things actually is in relationship with N.A.S.A., perhaps their view would change. For example, without N.A.S.A., we wouldn't have been able to use a G.P.S. or cell phones. That's a bit off topic, though, who knows, AIs might lead us to an even greater invention!

Why should main be declared static and is declaring it public and void not sufficient?

The static modifier means that it does not have to be instantiated to use it. Before a program runs there are technically no objects created yet, so the main method, which is the entry point for the application must be labeled static to tell the JVM that the method can be used without having first to create an instance of that class. Otherwise, it is the "Which came first, the chicken or the egg?" phenomenon. Your main method should be declared as follows: public static void main (String[] args) { lots of your java code... } As we know, java is a pure OOP , that means everything should be in the class, main. Aso, because main is itself a function, static member functions should not refer to objects of that class. But we can access static functions through classname itself, as: class TestMain { public static void main(String args[]) { body; } } Now, cmd>javac TestMain.java cmd>java TestMain as we know the static member functions has to call through its class name. That's why the programme name must be same as the class name ,where we wrote the main function. Another important point is : static variables or member functions will load during class. That means before creating any instances(objects), the main function is the first runnable function of any program which we run manually, such as : cmd>java TestMain(run) if , any sharing information.

Advantages of binary search over sequencial search?

Linear search takes linear time with a worst case of O(n) for n items, and an average of O(n/2). Binary search takes logarithmic time, with a worst and average case of O(n log n). Binary search is therefore faster on average.

Which module in a typical program will execute the most times?

There is no such thing as a typical execution environment let alone a typical executable, so it is impossible to say. However, there are a finite number of core operating system modules that are common to all platforms of the same type, so it is highly likely that one of these will be the most-executed upon those specific configurations.

What is high level disinfection?

High level disinfection is when something is disinfected very well where there are no germs left.

What is the relationship between a programming language and machine code?

About the relationship between engineering / architecture and plumbing in building houses.

Computer Science looks at how one figures out how to develop algorithms and methods of solving a problem. Computer Programming is the implementation in software code of the algorithm.

Write a C Program to draw concentric circles using mid-point algorithm?

#include

#include

#include

void main()

{

int gd=DETECT,gm=4,i;

initgraph(&gd,&gm,"c:\\tc\\bgi");

setcolor(3);

for(i=0;i<150;i+=5)

{

circle(300,300,i);

}

getch();

}

What is binary 11111111 equal to as a decimal?

11111111 = 255 in standard binary. think of it like so: 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 1 1 1 1 1 1 1 1

in other words, (1x128) + (1x64) etc. etc. In Signed Binary however, this would equal -127 since in signed binary, the first bit represents the sign for plus or minus. e.g 0 = +, 1 = -. as such: Plus or minus | 64 | 32 | 16 | 8 | 4 | 2 | 1 1 (-) 1 1 1 1 1 1 1

How to convert 2D array to single dimensional array?

You don't need to physically convert the array, you simply need to point at the first element and read the elements sequentially. The following code shows how to achieve this, as well as how to physically convert a 2D array to a separate 1D array. As can be seen, there is no practical benefit to making the conversion.

Example

#include

int main()

{

const int rows = 2;

const int cols = 3;

const int size = rows * cols;

// Create a static 2D array, intialise and print the matrix

int arr2[rows][cols];

std::cout << "2D array:\n" << std::endl;

for( int r=0; r

{

for( int c=0; c

{

arr2[r][c]= (r+1) * (c+1);

std::cout << arr2[r][c] << " ";

}

std::cout << std::endl;

}

std::cout << std::endl;

// Efficient conversion to 1D array:

// Point to the first element then print sequential values.

int* ptr = (int*) arr2;

std::cout << "1D array (using pointer):\n" << std::endl;

for( int i=0; i

std::cout << *ptr++ << " ";

std::cout << "\n" << std::endl;

// Inefficient conversion to 1D array:

// Copy the 2D array to a separate 1D array

int arr1[size];

ptr = (int*) arr2;

for( int i=0; i

arr1[i]=*ptr++;

// Print the copy:

std::cout << "1D array (using copy):\n" << std::endl;

for( int i=0; i

std::cout << arr1[i] << " ";

std::cout << "\n" << std::endl;

return( 0 );

}

Output

2D array:

1 2 3

2 4 6

1D array (using pointer):

1 2 3 2 4 6

1D array (using copy):

1 2 3 2 4 6

Why you use if and else statement in c language program?

There is no "elseif" statement in C. You can only use "else" and "if" separately. This is a good reason for switch/case/break.

Multithreaded program generates Fibonacci series using java-answer?

The formula for the Fibonacci series is

Fn = Fn-1 + Fn-2 for n ≥ 2 with F0 = 0 and F1 = 1.

In layman's terms, in the Fibonacci series each successive number is the sum of the previous two numbers, starting with 1. So we have 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 etc

To do this in Java or any computer program you will need to create a recursive program, one that picks up previous values. This is quite easy, even for a beginner, once one grasps the Fibonacci fundamentals. Here is an example in Java:

public class Fibonacci {

public static long fib(int n) {

if (n <= 1) return n;

else return fib(n-1) + fib(n-2);

}

public static void main(String[] args) {

int N = Integer.parseInt(args[0]);

for (int i = 1; i <= N; i++)

System.out.println(i + ": " + fib(i));

}

}

For n, enter the number of values required, otherwise the increasing values of the results will overflow the parameters of the data display!

This code can be adapted for any progamming language, e.g. pascal, basic etc. One can even use the principles to construct a spreadsheet that will show the Fibonacci series in successive rows in Excel, for example.

  • For more information, enhanced development and downloadable Java code for generating Fibonacci numbers, see 'Related links' below this box

How would you write a program that takes a string of characters and reverses them in the C programming language?

void main()

{char a[30] = "India";

//Let the string be stored in a[30];

char b[30]; //declaring another string

for(i=0;i<strlen(a);i++)

{b[strlen(a)-1 - i]=a[i];}

//Now reverse string is stored in b;

//to print it

cout<<b;

getch();

}

Where does the main function return the value in C programming language?

To fulfill the purpose I don't use return but use a different method. pass by references:

#include<stdio.h>

void myFunc(int n[]){

int i;

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

n[i] = i;

}

int main(void){

int a[10];

int i;

myFunc(a);

for(i=0; i<10; i++){

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

}

}

How do you find greatest factor of a number which is a factorial number in c language?

#include<stdio.h> #include<conio.h> main() { int f=1,i=1,n; clrscr(); printf("\n Enter factorial value"); scanf("%d",&n); for(;i<=n;i++) { f=f*i; } printf("\n The factorial value=%d",f); getch(); }

Which type of protocol is useful when data must be transferred fast?

connectionless protocols. A connection less protocol's lack of sophistication makes it more efficient than a connection-oriented protocol and renders it useful in situations in which data must be transferred quickly

Why is Java not a pure OOP Language?

Java is a OOP language and it is not a pure Object Based Programming Language.

Many languages are Object Oriented. There are seven qualities to be satisfied for a programming language to be pure Object Oriented. They are:

  1. Encapsulation/Data Hiding
  2. Inheritance
  3. Polymorphism
  4. Abstraction
  5. All predefined types are objects
  6. All operations are performed by sending messages to objects
  7. All user defined types are objects.

Java is not because it supports Primitive datatype such as int, byte, long... etc, to be used, which are not objects.

Contrast with a pure OOP language like Smalltalk, where there are no primitive types, and boolean, int and methods are all objects.