answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

Examples of high level computer languages?

Java and C# are all examples of high-level programming languages. High level programming languages separate the programmer from the machine through abstraction, allowing them to focus more upon the software rather than the underlying hardware, which is taken care of by a compiler and/or interpreter. The higher the level of abstraction, the less interaction there is with the machine itself. Java, for instance, has no low-level functionality whatsoever as all code is written against a virtual machine. This makes the language extremely portable as programs can be run on any machine with a Java virtual machine implementation, without any modification to the compiled byte code. The Java virtual machine is essentially an interpreter that translates the byte code to machine code.

Assembly and machine code are low-level languages. Before there were any languages, all code had to be written in machine code (long sequences of 1s and 0s), which was highly prone to error. Assembly language was the first programming language, and was used to make it easier to produce machine code. As such, every platform has its own version of assembler. As such, programs written in assembler or machine code are non-portable.

Mid level languages include C and C++. Both are really high-level languages as they can both be used to write portable code, but the amount of abstraction in C is almost non-existent because much of C can be mapped almost 1:1 with the resulting assembly, but with enough abstraction to make it much easier to work with. C++ is backwardly-compatible with C but is more flexible because the programmer can use as much or as little abstraction as required, giving the best of both worlds.

What does mean selection in c program?

selection Also called a decision, one of the three basic logic structures in computerprogramming. The other two logic structures are sequence and loop.

In a selection structure, a question is asked, and depending on the answer, the program takes one of two courses of action, after which the program moves on to the next event.

This structure is sometimes referred to as an if-then-else because it directs the program to perform in this way: If Condition A is True then perform Action X else perform Action Y.

All logic problems in programming can be solved by forming algorithms using only the three logic structures, and they can be combined in an infinite number of ways. The more complex the computing need, the more complex the combination of structures.

What processes are needed to transform a C program to a machine language program that is ready for execution?

  • 1st create source file using text editor for the compiler
  • 2nd check source file for syntax errors by the compiler
  • 3rd save it as object file by the compiler,
  • 4th combine object files and resolve external library references to create executable file by the linker.

You can get the detailed answer on P29-31 ,Problem_Solving & program_design_in_c.

First the source files must be pre-processed. This handles all the precompiler directives (such as #include which pulls in headers) and macro definitions (such as #define statements which perform text replacements). This creates intermediate files known as translation units, which are then passed to the compiler. Each translation unit is compiled into machine code to create an object file. Finally, all the object files are linked together along with any precompiled static library functions to create the executable.

There are three stages to the translation process: preprocessing; compiling and linking

Write an algorithm for the implementation of a circular doubly linked list?

  1. Create a new node, making sure it is not allocated locally in the function and thus will not be destroyed when the function execution finishes
  2. Fill in data
  3. Use the "last node" pointer in the list and copy the "next" pointer location (pointing to the first node) into the new nodes "next" pointer
  4. Set the "last node" "next" pointer to point to the new node
  5. Change the list's "last node" pointer to point to the new node

For an example of implementation see: How_you_insert_a_newnode_in_singly_circular_link_list

Program that implements breadth first search algorithm?

#include <stdio.h>

#include <conio.h>

#include <malloc.h>

#define TRUE 1

#define FALSE 0

#define MAX 8

struct node

{

int data ;

struct node *next ;

} ;

int visited[MAX] ;

int q[8] ;

int front, rear ;

void bfs ( int, struct node ** ) ;

struct node * getnode_write ( int ) ;

void addqueue ( int ) ;

int deletequeue( ) ;

int isempty( ) ;

void del ( struct node * ) ;

int main( )

{

struct node *arr[MAX] ;

struct node *v1, *v2, *v3, *v4 ;

int i ;

v1 = getnode_write ( 2 ) ;

arr[0] = v1 ;

v1 -> next = v2 = getnode_write ( 3 ) ;

v2 -> next = NULL ;

v1 = getnode_write ( 1 ) ;

arr[1] = v1 ;

v1 -> next = v2 = getnode_write ( 4 ) ;

v2 -> next = v3 = getnode_write ( 5 ) ;

v3 -> next = NULL ;

v1 = getnode_write ( 1 ) ;

arr[2] = v1 ;

v1 -> next = v2 = getnode_write ( 6 ) ;

v2 -> next = v3 = getnode_write ( 7 ) ;

v3 -> next = NULL ;

v1 = getnode_write ( 2 ) ;

arr[3] = v1 ;

v1 -> next = v2 = getnode_write ( 8 ) ;

v2 -> next = NULL ;

v1 = getnode_write ( 2 ) ;

arr[4] = v1 ;

v1 -> next = v2 = getnode_write ( 8 ) ;

v2 -> next = NULL ;

v1 = getnode_write ( 3 ) ;

arr[5] = v1 ;

v1 -> next = v2 = getnode_write ( 8 ) ;

v2 -> next = NULL ;

v1 = getnode_write ( 3 ) ;

arr[6] = v1 ;

v1 -> next = v2 = getnode_write ( 8 ) ;

v2 -> next = NULL ;

v1 = getnode_write ( 4 ) ;

arr[7] = v1 ;

v1 -> next = v2 = getnode_write ( 5 ) ;

v2 -> next = v3 = getnode_write ( 6 ) ;

v3 -> next = v4 = getnode_write ( 7 ) ;

v4 -> next = NULL ;

front = rear = -1 ;

bfs ( 1, arr ) ;

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

del ( arr[i] ) ;

getch( ) ;

return 0;

}

void bfs ( int v, struct node **p )

{

struct node *u ;

visited[v - 1] = TRUE ;

printf ( "%d\t", v ) ;

addqueue ( v ) ;

while ( isempty( ) -1 )

return TRUE ;

return FALSE ;

}

void del ( struct node *n )

{

struct node *temp ;

while ( n != NULL )

{

temp = n -> next ;

free ( n ) ;

n = temp ;

}

}

Difference between field and local variable?

Well, hehe its quite simple. You must be a dumb little nerd if you cant find it out. I suggest taking Pre IB computers and eating cherrios for breakfast to clear your mind. Maybe after a hot shower with your rabbit youll be able to brainstorm through the ultimate collage of confusion!

List the advantages of dynamic RAM compared with static RAM?

Static RAM and dynamic RAM are two available types of computer RAM, or Random Access Memory. One advantage of static RAM is speed, while a disadvantage is cost. An advantage of dynamic RAM is storage space, while a disadvantage would be speed.

Give a good name forcollege newsletter?

The Bugle, The Observer, The Report, The Scoop, Sentinel, Herald, Times, Chronicle, Journal, Inquirer, Post, Enterprise, Daily, Daily Chatter Box , (school ' s name ) Journal , Courier , Talk City , Post , News Are Us , Gazette , Press , Express . :)

What is an object oriented program?

The term "object-oriented program" is essentially meaningless. Object-oriented programming applies to high-level source code, not to programs.

High-level source code does not create a program as such because because the high-level instructions are far too abstract for the machine to understand. In order to create an actual program, the high-level symbolic code must be converted to native machine code, the only language the machine actually understands. This is achieved through compilation or interpretation or a combination of the two. Machine code is an entirely procedural language; there is no such thing as object-oriented machine code.

Machine code is non-portable. To overcome this, a compiler may convert the source code to an intermediate form such as byte code. Byte code is usually portable but it still needs to be converted to native machine in order to execute. This is achieved by an interpreter. The interpreter handles the execution, converting byte code to machine code while the byte code is executing within the interpreter. Although portable, byte code has to be interpreted every time it is executed, so it is much slower to execute than native machine code. However, like machine code, byte code is entirely procedural.

Although it is (theoretically) possible to execute high-level object-oriented instructions through interpretation, it makes no sense to do so as this would only reduce performance even further. The whole point of compiling to byte code is to produce code that can be efficiently interpreted in order to keep performance as high as possible.

Advantages of raster scan?

Raster-scan:-q1) Raster displays have less resolution.

q2) The lines producced are ziz-zag as the plotted values are discrete.

q3) High degree realism is achived in picture with the aid of advanced shading and hidden surface technique.

q4) Decreasing memory costs have made raster systems popular.

Random scan:-q1) Random displays have high resolutions since the picture definition is stored as a set of line drawing commands and not as a set of intensity values.

q2) Smooth lines are produced as the electron beam directly follows the line path.

q3) Realism is difficult to achieve.

q4) Random-scan system's are generally costlier.

What is the Advantage of method overloading?

Suppose that you have a class that can draw various types of data (strings, integers, and so on) and that contains a method for drawing each data type. In other languages, you have to think of a new name for each method, for example, drawString, drawInteger, drawFloat, and so on. In the Java programming language, you can use the same name for all the drawing methods but pass a different type of argument to each method. Thus, the data drawing class might declare three methods named draw, each of which takes a different type of argument.

What did Microsoft create?

Microsoft had its own version of DOS (Disk Operation System) which is a command line operating system (well sorta, it bought it originally and improved it) For more information try using a search engine and searching up the history of microsoft. (Try google)

What are the 2 basic functions used in encryption algorithm?

Two basic functions used in Encryption Algorithms are * Substitution * Transposition

A variable that is declared inside a method is called variable?

It is called a local variable since it only exists inside the method.

Write a program in c language to accept 10 strings as input and printthem in lexicographic order?

#include <stdio.h>

#include <string.h>

void main()

{

char a[4][25],temp[25];

int i,j;

clrscr();

printf("Enter the names\n");

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

gets(a[i]);

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

for (j=i+1;j<4;j++)

{

if (strcmp(a[i],a[j])>0)

{

strcpy(temp,a[i]);

strcpy(a[i],a[j]);

strcpy(a[j],temp);

}

}

printf("Sorted strings are \n");

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

puts (a[i]);

getch();

}

What is the purpose of program planning?

a delibrate series of action to achieve a specific target.

What are the types of error that occur in programming?

There are some types of errors, eg:

1. Compile Errors

1.1. Syntax Errors

2. Run time Errors

2.1. Segmentation fault (or: invalid page fault)

2.2. Division by zero

2.3. Value out of range

syntax error refers to an error in the syntax of a sequence of characters or tokens that is intended to be written in a particular programming language.
x=1;

y=x++;

y=++x;

give me answer and how work it.

What is the Difference between function and program and software?

SOFTWARE is a collection of some programmes which is designed for specific task to be done.while the programme is a set of instruction written in a comp understood language to do a specific work. Ex: Calci is a software and the instructions written to add two numbers is a programme.but calci has many functions for all of which has different programmes written..

What are digital computers used for?

Digital computers, well, your using one to ask your question!

Digital computers, most people just call them Computers, or PC's, are used for a variety of things.

For one, the Internet, which you are using right now on a Digital computer. All computers are digital.

Perhaps you should research PC's

http://en.wikipedia.org/wiki/Digital_PC

Other uses:

Games

Writting documents

Reading information

Information databases

Website hosting (servers)

Research

Data collection

And so much more!

Is programming an art or science discipline?

It is both. Firstly it is a science. Computing is a science and programming is a science. However, there is an artistic element to it too. Scientifically there are a set amount of commands in any programming language with a strict syntax and rules as to how they can be used. It is up to programmers how they use them to solve a particular problem. Some of them are more creative in how they use them to solve a problem. The different programmers are using the same language and commands and have a full knowledge of the language, but they use them in different ways. Some are better at doing it than others. That is where the art and creativity comes in.

Looking at it another way, you can read a book written by a great author, because you know all of the words used in it. However, you would not have been able to create that story yourself. So although you know the same words in your language that the author does, the author is able to think of clever ideas and use the words more creatively than you can. In some ways, programming is the same. So some programmers have that creative flare, so in the way that writing a book is an art form, writing a really good computer program can be an art form too.

Write a c program to print 1 232 34543 5678765 using for loop?

If you visualize 1123581321 as a set of numbers (without spaces in between) instead of one number, you'll see that it's a set of the first 8 Fibnocci nos. - 1 1 2 3 5 8 13 21.

The following program would print the required no. using a For looping structure.

int main (void)

{

int i=1;

int j=1;

int k, num=1;

for(k=0; k<7; k++){

if(k==0){

printf("%d", num);

}

printf("%d", num);

//next no. is the sum of previous two nos. in the series

i=j;

j=num;

num=i+j;

// 1 + 1 = 2 ... 1 + 2 = 3 ... 2 + 3 = 5 ... 3 + 5 = 8

// sum=i + j ... i takes value of j ... j takes value of sum ... repeat.

}

}

What is the storage allocation and scope of global extern static local and register variables?

AnswerLocal Variables are stored in Stack. Register variables are stored in Register. Global variables are stored in data segment. The memory created dynamically are stored in Heap And the C program instructions get stored in code segment and the extern variables also stored in data segment.

Nooo Nooo

Static variable will be stored in .BSS segment... (Block Started By Symbol)