answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

C program for linear search using non recursive functiontion?

void main(){

int a[10],i,n,m,c=0;

clrscr();

printf("Enter the size of an array");

scanf("%d",&n);

printf("\nEnter the elements of the array");

for(i=0;i<=n-1;i++){

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

}

printf("\nThe elements of an array are");

for(i=0;i<=n-1;i++){

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

}

printf("\nEnter the number to be search");

scanf("%d",&m);

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

{

if(a[i]==m)

{

c=1;

break;

}

}

if(c==0)

printf("\nThe number is not in the list");

else

printf("\nThe number is found");

getch();

}

--------------------------------------------------------------------

Answer by Jatinder Pal Singh


#include
#include
void main()
{
clrscr();
int i,n,item,a[20];
printf("\nEnter no of elements=");
scanf("%d",&n);
printf("\nEnter %d elements=",n);
for(i=0;i{
scanf("%d",&a[i]);
}
printf("\nEnter the element to be search=");
scanf("%d",&item);
for(i=0;i{
if(a[i]==item)
{
printf("\n\t%d is present at position %d",a[i],i+1);
break;
}
}
if(i==n)
printf("\nElement is not Present");
getch();
}

Which is the first step in the program development cycle?

Mainly for every program to be created these are the fundamental steps to be noted by every one

They are....

1. Analysis of the problem given by the user:

In this the problem given is discussed and understanding the problem by revising it carefully and assess the needs of the users.

2. Specification and design of the problem:

i.The problem given to the programmer is accessed and define a format and type the data to the program.

ii.The design of the screen the user will use

iii. defining the kind of data entered to the program and required data to be displayed by the program

iv. Drawing the alogorithm, flow charts to caluclate outputs for the given inputs by the user.

3. Writing an program:

A program is written to the problem given by the user and writing the code necessary to fullfill all the requirements of the problem. The code is a text based file which when complied creates the program.

4. Finding of errors:

Errors in programming are of three types they are

i. Syntactical errors

ii. Logical errors

iii. Run time errors

detection of these errors from the program and eliminating them

5.Testing of Program:

Testing of an program is done in two steps

i. Alpha test:

Here the program is checked initially by the programmer.

ii. Beta test:

Here the officials who are having a knowledge in programming will test the program and find out if there are any errors in it.

6. Documentation of the program:

The Documentation of the program that describes how it will works and how to run it. If there are any errors after the delivery of the program then it can be eradicated by updating the version by removing the errors

What are the importance of expert system?

the benefits of ES to end users include:

  • A speed-up of human professional or semi-professional work -- typically by a factor of ten and sometimes by a factor of a hundred or more.
  • Within companies, major internal cost savings. For small systems, savings are sometimes in the tens or hundreds of thousands of dollars; but for large systems, often in the tens of millions of dollars and as high as hundreds of millions of dollars. These cost savings are a result of quality improvement, a major motivation for employing expert system technology.
  • Improved quality of decision making. In some cases, the quality or correctness of decisions evaluated after the fact show a ten-fold improvement.
  • Preservation of scarce expertise. ESs are used to preserve scarce know-how in organizations, to capture the expertise of individuals who are retiring, and to preserve corporate know-how so that it can be widely distributed to other factories, offices or plants of the company.
  • Introduction of new products. A good example of a new product is a pathology advisor sold to clinical pathologists in hospitals to assist in the diagnosis of diseased tissue.

Compare c plus plus and visual basic?

Visual Basic is a Windows-specific programming language, developed by Microsoft. C++ is a standard, generic and cross-platform programming language. Microsoft's implementation is called Visual C++, but it is not standards-compliant. Visual Basic requires a runtime library. C++ does not. Visual Basic is 100% object-oriented. C++ is not 100% object-oriented, but gives programmers greater freedom of choice. C++ is efficient, compact and performs extremely well on a wide variety of hardware. Visual Basic programs are inefficient, generally large, and much slower than equivalent C++ programs, and only run on Windows.

What do you know about structure programming language?

first write main function and what are the use classes which type you want then give the data members to the member functions finally you will terminate the program

Difference between computer application and IT?

computer application is just software, IT (information technology) in general is an organization, or the persons within that organization.

They are totally different, apple and Apple computer!

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);

}