What is the difference between inlinefunction and function overloading?
The normal way a function works is that whenever your code encounters a call to the function, it jumps to the body of the function code. An inline function tells the compiler that it should actually copy over the code from a function body into all places where that function is called. In some cases this can cause a dramatic reduction in run time, but in others it causes nothing more than increasing the size of the produced executable.
Function overloading refers to the ability to have multiple functions with the same name, but different parameter types.
What programming language is used to develop facebook?
Different languages like Java, Python, PHP, C++ and Ruby building its stack that allows to all languages stated to interoperate.
How do you find in java the sum of the first and last digit of 3 digit number?
String num = Integer.toString(12345); // Insert your Integer here.
int sum = 0;
for(int i = 0; i < num.length(); i++){
sum += Character.digit(num.charAt(i), 10);
}
System.out.println(sum); // Simply prints the sum of the digits to standard out.
///// ALTERNATE SOLUTION:
int num = 12345; // Insert your Integer here.
int sum = 0;
while (num > 0){
sum += num % 10;
num /= 10;
}
System.out.println(sum); // Simply prints the sum of the digits to standard out.
How did bill gates come up with the idea for Microsoft?
Bill Gates actually did create those things. it was created as a way to compete with Apple and Netscape, respectively.
What do you need to start programming using pascal?
Three simple steps: (1) buy or rent a boook about Pascal, (2) read book and follow the exercised provided in book, (3) write program in Pascal. Honestly. A programming language is in many ways as complex as a human language; there is no simple answer to "how does one speak French, or Spanish, or Pascal, or C++" However, in all those cases, an abundance of books is available. Since they all vary not just in quality, but also with regards to the expectation to your background knowledge, its typicaly best to go into a bookstore and compare a few.
Differce between linker and loader?
#)Linker is a program that takes one or more objects generated by a compiler and combines them into a single executable program.
#)Loader is the part of an operating system that is responsible for loading programs from executables (i.e., executable files) into memory, preparing them for execution and then executing them.
What is the need of two pass assembler?
#include<stdio.h>
#include<conio.h>
#include<string.h>
struct symbol
{
char sn[35];
int add;
}s[35];
void main()
{
int symerr=0,oper=0,i=1,j=1,lc,k,sa,p1,f,op,l,q,d,x=1;
char opcode[50],lb[25],operand[25];
char optab[10][10]={"LDA","LDB","STA","ADD","COMP","J","JEQ","SUB","STA"};
char value[10][10]={"00","b8","0c","18","28","3C","30","lc","14","78"};
FILE *fp1,*fp2;
clrscr();
fp1=fopen("input1.txt","r");
fp2=fopen("inter.txt","w");
fscanf(fp1,"%s %s",&lb,&opcode);
if(strcmp(opcode,"START")==0)
{
fscanf(fp1,"%d",&lc);
sa=lc;
fprintf(fp2,"%d\t %s\t %s\t %d\n",lc,lb,opcode,lc);
fscanf(fp1,"%s %s",&lb,&opcode);
}
while(!feof(fp1))
{
d=lc;
if(strcmp(".",lb)!=0)
{
if(strcmp("-",lb)!=0)
{
for(i=1;i<=j;i++)
{
if(strcmp(s[i].sn,lb)==0)
symerr=1;
break;
}
if(symerr==0)
{
strcpy(s[j].sn,lb);
s[j].add=lc;
j++;
}
}
for(k=0;k<10;k++)
for(l=0;l<10;l++)
if(optab[k][l]==opcode)
{
fscanf(fp1,"%s",&operand);
lc=lc+3;
x=0;
}
if(strcmp(opcode,"RESW")==0)
{
fscanf(fp1,"%s",&operand);
op=atoi(operand);
lc=lc+(op*3);
}
else if(strcmp(opcode,"RESB")==0)
{
fscanf(fp1,"%s",&operand);
op=atoi(operand);
lc=lc+op;
}
else if(strcmp(opcode,"BYTE")==0)
{
fscanf(fp1,"%s",&operand);
f=strlen(operand);
lc=lc+(f-3);
}
else if(strcmp(opcode,"WORD")==0)
{
fscanf(fp1,"%s",&operand);
lc=lc+3;
}
else
{
if(x==1)
{
fscanf(fp1,"%s",operand);
lc=lc+3;
}
}
}
fprintf(fp2,"\n%d\t%s\t%s\t%s\n",d,lb,opcode,operand);
if(symerr==1)
fprintf(fp2,"\n**DUPLICATE SYMBOL**\n");
if(oper==1)
fprintf(fp2,"\n**INVALID OPERATION CODE**\n");
fscanf(fp1,"%s\t%s",&lb,&opcode);
symerr=0;
oper=0;
}
p1=lc-sa;
fprintf(fp2,"\nThe program length is %d",p1);
printf("\n symbol table\tlabeL address\n");
for(q=1;q<j;q++)
printf("\n%s\t%d",s[q].sn,s[q].add);
fcloseall();
getch();
}
What are the difficulties in writing programs in machine language?
Machine language is error prone simply because it is so difficult to write programs using nothing more than binary notation. Every instruction, every register and every memory address has to be converted to binary. Just one bit out of place would render the code invalid. Trying to find one errant bit amongst many millions is no easy task.
Of course we don't actually use binary (base-2) to write machine code. Any base that is itself a power of 2 will do. Binary is 2^1 while 2^2 is base-4, 2^3 is base-8 (octal) and 2^4 is base-16 (hexadecimal). The advantage of using these higher bases is that instead of entering machine code one bit at a time, we can enter a group of bits using just one symbol. If we divide binary data into groups of 2 bits, then there can be only 4 possible combinations (00, 01, 10 and 11). Base-4 only has 4 possible digits (0, 1, 2 and 3) so it is trivial to map each group of 2 bits to just one base-4 digit. If we divide binary data into groups of 3 bits then there would be 8 possible combinations, each of which can be represented by just one octal digit. And if we divide into groups of 4 bits we get 16 possible combinations each of which can be represented with just one hexadecimal digit. A byte is usually 8 bits long, so if one hexadecimal digit represents half a byte (a nybble) then two hexadecimal digits represent a full byte.
Converting from hexadecimal to binary is so trivial that we can easily write a simple machine code program to perform the conversion for us. This reduces the chances of making errors during input by a factor of 4. However, reducing the chances of error doesn't eliminate errors. Programmer's are only human and if a programmer can make mistakes using a high-level language, then the odds of making a mistake in low-level machine code is greatly multiplied. No matter how much time you spend designing, one mistake is all it takes. And if a mistake is made, finding it is easier said than done.
To reduce the chances of mistake even further, it is best to steer clear of machine code altogether and use assembly language. Assembly language is a symbolic language, so just as binary values can be symbolised through hexadecimal notation, operation codes can be symbolised through easy-to-remember mnemonics. That is, instead of having to remember that code 80 moves a memory address into a register and that 81 moves a register value to that memory address, we need only remember that MOV does both and will translate to the appropriate instruction according to the operands we provide. Assembly language also allows us to use any notion that is most convenient, including decimal, octal, hexadecimal or even binary itself. Every register has a unique identifier and we can also give static, global and constant data user-defined names, so we don't need to keep track of every memory address. We can also insert comments!
Although assembly language is not machine code, the translation from assembly language to machine code is virtually 1:1, there is very little in the way of abstraction. We still won't eliminate programming errors, but at least we have a fighting chance of locating them and ultimately fixing them.
Writing machine code programs in assembly is nonetheless a laborious process. So much so that machine code programmers often prefer to use high-level languages like C and C++ to do the bulk of the work to generate the assembly language which they can then tweak further by hand where necessary. However, C++ in particular produces such good machine code by itself that programmers rarely need to "bang the metal". Indeed, many of the optimisations utilised by the C++ compiler came from the tricks of the trade used by machine code programmers themselves. As a result, C++ can often produce machine code that surpasses anything that can be produced by hand -- but even when it can't, tweaking machine code is so much easier when you don't have to write every single bit from scratch.
What are the difference between greedy algorithm and dynamic programing?
A greedy algorithm is similar to a dynamic programming algorithm, but the difference is that solutions to the subproblems do not have to be known at each stage; instead a "greedy" choice can be made of what looks best for the moment.
Can you declare a variable in different scopes with different data types elaborate with examples?
Yes. Because a variable of the more local scope is what is used instead of any other variables with that name, the data types of the other variables that use that name are irrelevant.
It is, however bad practice to do this because it is confusing and often leads to unintentional function behaviour (particularly in weakly typed languages). If the variable in question is meant to be used in different functions and with a different purpose, there is probably no need to give it the same name as another.
What is the cost of a shopping cart?
Shopping carts are a broad range of technologies that enable visitors to a website to buy goods and services. As can be expected of any general technology the cost varies from vendor to vendor, and from installation to installation.
Open Source Shopping CartsThere are several free, open source shopping carts osCommerce and Zen Cart are two of the most popular, although the Community Edition of Magento has recently increased market share considerably.
These shopping carts cost nothing to download and install.
Commercial Shopping CartsInterspire Shopping cart is available from $295.00, Cube Cart starter edition is $129.00. X-Cart is available from $115.00
Hosted Shopping CartsBig Commerce, Shopify and Volusion are the three most popular hosted shopping carts and all start there pricing at $24.95 per month. Custom and Enterprise Shopping CartsThere are no set prices for custom and most enterprise shopping carts as the price is a reflection of the features and support required but anything form several thousand to several hundred thousand dollarsHow you can delete a column from the table?
Can you be more specific? What kind of table do you mean, and what program are you using? A SQL statement like this will do it: alter table tblName drop column colName tblName is the name of the table colName is the name of the column
When shall you use Multiple Inheritance?
Multiple inheritance is used when a new class to be formed has to inherit characteristics from two or more classes. eg: class scientist class labourer | | | | V V -------------------------------- | class employee | -------------------------------- Multilevel inheritance is used if a derived class inherits characteristics from a base class which is a derived class (intermmediate base class). If the inheritance level is more than two then it is a multilevel inheritance. eg: class Grandfather | | V class Father | | V class son
Distinguish between the Classes and Objects?
A Class is a template from which Objects are created, in much the same way as a plan of a building is a template from which a building is created... just as the building plan is a piece of paper and not a building, so a Class is not an Object.
The code for a Class describes the way in which an Object should behave when particular methods are invoked.
Why do abstract class can not be inherited?
An abstract class is designed to provide function and organization to subclasses without ever existing as an object itself. In other words, it is a glorified template, an abstraction for subclasses, and would be illogical to instantiate.
As an example, imagine that a zoo wanted to make separate classes representing each of its animals, but wanted them to all have some common features like a variable for life expectancy or a method to project feeding costs. To force every class to implement this functionality, the programmer may create an abstract class called Animal that each subclass would extend. However, would it ever make sense to create an Animal? No, because an Animal does not exist anywhere in the zoo - an Alligator however might.
A petabyte is either 1 000 000 000 000 000 bytes
or 1024 x 1024 x 1024 x 1024 x 1024 bytes.
It is the next in the series kilobyte, megabyte, gigabyte, terabyte, petabyte, ...
peta means 1015 but in computing 1000 and 1024 sometimes get interchanged.
What are the applications of gray code?
Gray code is useful because only one bit changes at a time. When used as encoders for a position sensor, for instance, if the sensor were right at the edge of a change boundary, there is uncertainty as to position. Binary code would introduce variable uncertainty in position, because more than one bit can change at a time, but gray code would reduce that uncertainty to being only one bit position in size.
GL acronym stands for the 3rd Generation language like C, C++, Java, etc
How do you convert the number 1101 in binary form?
Counting to 15 in binary:
0
1
10
11
100
101
110
111
1000
1001
1010
1011
1100
1101
1110
1111
How many steps are in the system development life cycle?
Hi,
1. Project Plan - Draw a plan for your development project
2. Functional Requirement Specification - Define what the business needs
3. System Requirement Specification - Define how you achive the above with Operating System, Database, Software Development Tool, etc
4. High Level Design - The database structure & Data Flow diagram
5. Low Level Design - The Screen/Report layout, conditions, validations etc
6. Testing - Unit Testing, Integration Testing, System Testing
7. Documentation - User manual & Technical manual
8. Deployment - Implementing the developed application
9. Maintenance - Maintain the developed application, for bug fixing, new feature inclusions, changes to the existing functions Hope this helps
What is worst case and average case complexity of linear search algorithm with explanation?
For a list with n elements, the expected cost is the same as the worst-case cost, which is O(n). The average cost will be O(n/2). However, if the list is ordered by probability and geometrically distributed, the complexity becomes constant, O(1). Compare with a binary search which has a cost of O(log n).
What is the advantages of high level languages to low level languages?
High Level Language:
High level language are easier to use and less technical skills are required to do a program. It is very useful where textual data is given priority. Troubleshooting doesn't takes a longer time. We get to know the errors very easily.
Low Level Language:
Low level language are not easily read at a glance and very high technical skill are required to do a program. Troubleshooting takes a longer time. They can produce stunning graphics.
What is 00001010.01100100.00000111.00010101 to decimal?
It's quite easy to convert binary into hexadecimal (hex) by grouping each 4 binary digits (bits) into a single binary hex digit:
0A 64 07 15
From there it's easier to convert into decimal in the head:
10 100 7 21
If you will be doing much in the way of programming computers, or working with TCP/IP networking, it is definitely a good idea to spend some time familiarising yourself with hexadecimal and converting between hex, binary and decimal.
For reference, converting from binary to hex is done like this:
0000 = 0
0001 = 1
0010 = 2
0011 = 3
0100 = 4
0101 = 5
0110 = 6
0111 = 7
1000 = 8
1001 = 9
1010 = A
1011 = B
1100 = C
1101 = D
1110 = E
1111 = F
What is the best email client?
Here is a list of the order of all e-mail clients that I've used in the past. My E-Mail Accounts:
First-Windows Hotmail (Old) Second-Yahoo! Mail (Old) Third-GMX (Old) Fourth-AOL (Old) Fifth-Mail.com (Old) Sixth-AOL (Current) Seventh-Windows LIVE Hotmail (Current)
Describe how data is shared by functions in a procedure oriented programming?
If you are talking about procedural languages like C, then you have two options:
Declaring global variables. These can be declared in header files, which are #included in source files to gain access to the shared data variable. Another way is to define a variable in a source file, then declare it extern in the other source files that use this variable. Note that the use of global variables is risky and generally frowned-upon.
Passing variables as function arguments. Some languages make a distinction between passing by value vs by reference. In C, everything is passed by value, even the arrays you pass are passed by value (the passed value is a pointer to the zero-th element of the array).
There are other ways of course, like using shared external files (especially if the data is shared between different processes, or multiple instances of the same process), shared memory, and semaphores (which are collectively known as IPC - InterProcess Communication).