What is the difference between target code and source code?
Source code and target code are the input and output of programming language translation programs such as assemblers, compilers and interpreters.
An assembler is used to convert low-level assembly instructions into native machine code, thus the source code is assembly language and the target code is native machine code. The target code is typically saved to a file known as an executable. Once converted to native machine code, no further translation is required; the executable can be executed at a later date and as often as required upon any machine of the same type and equivalent system and supporting libraries and software, and with optimal execution speed.
An interpreter is used to convert a high-level language source to machine code while the source code is executing. The source code is executed by the interpreter but, unlike an assembler, the resultant machine code is not saved to a file. As such, the source code must be re-interpreted every time it is executed, thus execution speed is extremely slow. However, the source code is extremely portable and can be executed upon any machine that has a suitable interpreter. The main advantage of interpreted languages is that the source code can be changed while it is executing, so the programmer can see the effect immediately.
A compiler is used to convert source code written in a high-level programming language to that of a lower-level target language. Typically the lower-level language is native machine code and, as with assembly, the target code can be saved and executed at a later date with optimal performance.
However, not all compilers compile to machine code. Some compile to assembly (which requires an assembler to complete the translation) while others convert to an intermediate code known as byte code. Byte code is intended to be interpreted by a virtual machine and can be thought of as being the native language of the virtual machine. As with all interpreted languages, the byte code is extremely portable and can be executed upon any physical machine that supports the appropriate virtual machine implementation. Java is an example of this.
Compilers can also translate code between two high-level languages so long as the target language is a lower level than the source language. The original C++ compiler worked this way, translating the C++ source into a C target which could then be compiled to machine code using the C compiler.
for (int n = 0; n <=100; n++) // you may start n = 1, same result, 1 less iteration
{
if (n % 6) // or, n % 6 != 0
printf(n);
}
What you mean by row major and column major?
its the method for sorting the multidimensional array.
eg:
consider the matrix: 10 1 3
2 7 5
8 6 4
row-major order: 1 3 10
2 5 7
4 6 8
column major order: 2 1 3
8 6 4
10 7 5
What is structure query language?
ADVANTAGES :)-
1.Its a high speed language.
2.There is not much of coding required like codind of programming languages.
3.Its emphasize on the concept of ORDBMS.
Disadvantages:(-
only 1
Its not v.user friendly!!
an assembly language is a computer-oriented language with instruction that are in one-to-one correspondence with machine instruction. In assembly language a symbol is used for each machine instruction, which is subsequently translated into machine language.
Which programming language uses a string of 1s and 0s?
You, as a programmer, can use a string with 1s and and 0s (or any other content) in each and every programming language.
Y2K simple means year 2 thousand.
y=year
2=2
k=1000 (kilo), in the metric system k is representative of 1000. for example, 1 Km is equivalent to 1000m.
When we approached the year 2000, it was thought by many that many of the world's computers would not have the capability to switch over from 1999 to 2000. Many people stocked up on non-perishables in fear of the world shutting down because of this.
However, nothing happened.
Many people believe that it is the year 2001, not 2000, that would create such panic that was created by Y2K, because we started counting (records begin) at year 1, not year '0'.
Again, however, nothing happened.
Where are trees in data structures implemented in the real world?
First off, there are several types of trees in data structures. each with different uses and benefits. The two most common are binary trees and binomial trees.
Binary trees are used most commonly in search algorithms. The benefits of this is that a search can be performed in O(lg(n)) time, instead of the O(n) time that a sequential search takes. An example from the real world of a binary tree in action is in databases, where indexes are organized in a binary tree, thus enabling faster searching.
Binomial trees are usually used in communication, particularly when distributing or aggregating information. A real world example comes from supercomputers, where multiple processors are all working simultaneously. In order to aggregate or distribute data, a binomial tree structure is commonly employed.
Why it is necessary to plan a computer program?
if we do-not plan a program then we are not able to know that what to do next
Deference between classical waterfall model and iterative waterfall model?
Major difference between waterfall and iterative model is that waterfall model has a linear process in which full product is available after the last phase, while incremental model full product is available after several such phases.
Data flow diagram for airline reservation system?
Each airline may have a slightly different diagram available. You can do an image search online to find the diagram that you want.
C++ is general-purpose and portable, which is common to many high-level languages, but it excels in terms of performance, comparable to that of assembly language. This is not surprising given the amount of work that goes into optimising the native machine code that the C++ compiler produces.
Java is arguably more popular today (especially with amateur programmers), but it doesn't perform well when compared to C++. This is largely due to the much higher level of abstraction which requires compiled programs to be executed and interpreted by the Java virtual machine. The main advantage of Java is that the abstraction allows Java programs to be run on any platform that supports the JVM without the need to modify the source code and recompile, which is the main disadvantage of C++. However, in terms of performance alone, few languages can compete with C++, hence its huge popularity in the community.
Why should use extreme programming methodology?
The purpose of extreme programming methodology is to improve software quality and responsiveness to meet the customer's requirements. As frequent changes require updated programming to make things run smoothly.
What type of a program is used in order to enter c source code?
What type of a program is used in order to enter C source code
Delphi was the Oracle of Apollo. It was there that mortals went to seek answers to their future. A young priestess sat on a tripod, inhaling fumes from the crevice that she sat by, and priests told the seeker what she had said. It was usually ambiguous, and the seeker had to figure out the meaning of it.
Besides the second letter of the alphabet it can also mean bytes.
C program for knapsack algorithm?
#include<stdio.h>
#include<conio.h>
int w[10],p[10],v[10][10],n,i,j,cap,x[10]={0};
int max(int i,int j)
{
return ((i>j)?i:j);
}
int knap(int i,int j)
{
int value;
if(v[i][j]<0)
{
if(j<w[i])
value=knap(i-1,j);
else
value=max(knap(i-1,j),p[i]+knap(i-1,j-w[i]));
v[i][j]=value;
}
return(v[i][j]);
}
void main()
{
int profit,count=0;
clrscr();
printf("\nEnter the number of elements\n");
scanf("%d",&n);
printf("Enter the profit and weights of the elements\n");
for(i=1;i<=n;i++)
{
printf("For item no %d\n",i);
scanf("%d%d",&p[i],&w[i]);
}
printf("\nEnter the capacity \n");
scanf("%d",&cap);
for(i=0;i<=n;i++)
for(j=0;j<=cap;j++)
if((i==0)(j==0))
v[i][j]=0;
else
v[i][j]=-1;
profit=knap(n,cap);
i=n;
j=cap;
while(j!=0&&i!=0)
{
if(v[i][j]!=v[i-1][j])
{
x[i]=1;
j=j-w[i];
i--;
}
else
i--;
}
printf("Items included are\n");
printf("Sl.no\tweight\tprofit\n");
for(i=1;i<=n;i++)
if(x[i])
printf("%d\t%d\t%d\n",++count,w[i],p[i]);
printf("Total profit = %d\n",profit);
getch();
}
What is the C program for byte stuffing with the output?
//Sender
#include<string.h>
#include<stdio.h>
#include<unistd.h>
#include<fcntl.h>
#define SIZE 40
struct frame
{
char str[SIZE+1];
char tmp[2*SIZE];
char flag;
char e;
char final[2*SIZE];
}s;
main()
{int fd,len1;
int i,j,len;
fd=open("b1",O_WRONLY);
printf("\nEnter flag character and escape character for byte-stuffing:");
scanf("%c %c",& s.flag,&s.e);
printf("\nEnter string:");
scanf("%s",s.str);
len=strlen(s.str);
for(i=0,j=0;i<len;i++,j++)
{
if(s.str[i]==s.flag)
{
s.tmp[j]=s.e;
s.tmp[j+1]=s.flag;
j++;
continue;
}
else if(s.str[i]==s.e)
{
s.tmp[j]=s.e;
s.tmp[j+1]=s.e;
j++;
continue;
}
else
{
s.tmp[j]=s.str[i];
}
}
printf("\nAppended string is==>%s \n",s.tmp);
len1=strlen(s.tmp);
for(i=0,j=0;i<=len1;i++,j++)
{
if((i==0)(i==len1))
{
s.final[j]=s.flag;
s.final[j+1]=s.tmp[i];
j++;
continue;
}
else
{
s.final[j]=s.tmp[i];
}
}
printf("\nFianal string is==>%s\n",s.final);
write(fd,&s,sizeof(s));
}
//Reciver
#include<string.h>
#include<stdio.h>
#include<unistd.h>
#include<fcntl.h>
#define SIZE 40
struct frame
{
char str[SIZE+1];
char tmp[2*SIZE];
char flag;
char e;
char final[2*SIZE];
}r;
main()
{
int fd,len1;
int i,j,len;
mknod("b1",010666,0);
fd=open("b1",O_RDONLY);
read(fd,&r,sizeof(r));
printf("\nFlag character is==>%c\n",r.flag);
printf("\nEscape character is ==>%c\n",r.e);
printf("\nAnd actual message was ==>%s\n",r.str);
printf("\nReceived message is %s\n\n",r.final);
}
/*****************
[mca222@rcclinux mca222]$ cc -os byte_s.c
[mca222@rcclinux mca222]$ cc -or byte_r.c
[mca222@rcclinux mca222]$ ./r&
[1] 1570
[mca222@rcclinux mca222]$ ./s
Enter flag character and escape character for byte-stuffing:#
@
Enter string:sim#andh@ar
Sending message is==>#sim@#andh@@ar#
Flag character is==>#
Escape character is ==>@
And actual message was ==>sim#andh@ar
Received message is #sim@#andh@@ar#
What is basic computer programming?
It could be one of two things:
What is a complier in computer language?
A compiler is a program that translates a programming language (like c++, java, pascal, php etc...) to a language that computers can "understand" (i.e. "1001010110101010...")