Advantages of Typeless programming language?
* In a typeless language, a variable can contain any kind of value (numeric, string, boolean). * Typeless languages are very flexible and dynamic, resulting in quick turn around of code.
Can you divide pointer variables?
No, but if you really want that, use type-cast, for example:
printf ("main=%p=5*%lx\n", main, ((long)main)/5);
Of course it is good for nothing at all.
When we insert a new node in a binary search tree will it become an internal node or terminal node?
It will be come a terminal node. Normally we call terminal nodes leaf nodes because a leaf has no branches other than its parent.
What is different between while and for loop in c plus plus?
Although both can achieve very similar loops, the one you use for a specific loop usually comes down to whichever seems more intuitive to you. In terms of performance, one method may be slightly more efficient than the other, however there are no general rules that can be applied; you must test each case by comparing the machine code or by physically timing the loops with a high performance event timer (HPET). In my experience, the performance difference is so negligible it is not worth the effort. Background activity has a far greater impact on performance.
Describing the differences between every possible loop you might create would take me a lifetime, but there are a couple of subtle differences that are worth pointing out.
Infinite Loopsfor(;;){
} // infinite for loops do not require a condition.
while( true ){
} // infinite while loops MUST have a condition.
To break out of an infinite loop you must test for one or more conditions within the loop itself, and call break to exit the loop when a condition is met. You can also call continue to start the next iteration before reaching the end of the current iteration.
Stepping LoopsWhen stepping through a series of values, the for() loop is usually the better choice, especially if the step must occur AFTER each iteration. Consider the following similar loops:
for( int x=0; x<10; ++x ){
// if we place continue here, ++x will execute before the next iteration begins.
}
int x=0;
while( x<10 ){
// if we use a continue here, ++x will not execute. We could be here forever!
++x;
}
Another point to bear in mind here is that with the for()loop, x will fall from scope when the loop finishes. If x must remain in scope, initialise x before entering the for() loop. With the while() loop, x is still in scope when the loop finishes so if x must fall from scope, do not use the while() loop.
do...while LoopsThe do...while loop is quite different from for()and while() loops, so it is worth mentioning here. Both for() and while() loops test a condition BEFORE the loop begins execution. If the condition is false, the loop may not execute at all. But a do...while loop is guaranteed to enter the loop AT LEAST once, because the condition is tested AFTER the loop begins, at the end of the loop just before it begins to iterate.
int x = 0;
do{
// Whatever you place here will execute at least once.
// If we place continue here, execution jumps to the while(condition) first.
}while(++x != 10)
In dos what is the function of a parameter?
A parameter is a command-line switch or an argument to a function. We use parameters to specify the input variables for the commands or functions we invoke. For instance, when we want to list the contents of a directory or folder, we have to pass the directory or folder path to the appropriate command so that it knows which directory or folder to process.
How many headerfiles in c language?
* complex.h
* ctype.h
* fenv.h
* float.h
* math.h
* setjmp.h
* signal.h
* stdarg.h
* stdio.h
* stdlib.h
* string.h
* tgmath.h
* time.h
What is existantial quantifier and universal quantifier?
The Existential Quantifier, usually written as a back-to-front capital E indicates the existence of a thing of a certain sort satisfying certain conditions. The Universal Quantifier, usually written as an upside-down capital A, indicates that every thing of a certain sort satisfies those conditions.
Sum of the digits of a number equals the number.Generate such numbers?
It appears that only single digit numbers work (0 thru 9)
conditions
What is the different between syntax and semantic?
The syntax of an operator is how it is used in an expression, i.e., how it looks. The semantics of an operator are what it does, how it works, and what side-effects it has.
Syntactically, "+" is written as "A + B"; semantically, it returns the sum of its operands.
What is a intelligent compiler?
3 Conditions to follow :
1. Fast
2. Language self
3. Correct, Repair, Dictate fast accuracy
What A CPU really only understands instructions that are written in machine language.?
A CPU will have an "instruction set" which consists of primitive instructions i.e a command like MOVE:1002,1003 could be an example of an instruction to move the contents in memory location 1002 to the memory location of 1003. Some CPU's operate as a RISC (Reduced Instruction Set Computer) and others operate as a CISC(Complex Instruction Set Computer). Which basically means some have more "primitive instructions" than others but the more complex an instruction is - The more work will be needed to execute it. Alan Turing proved only 6 of these primitive commands are needed to compute anything that is "computable" by machines. Nowadays, programmers will write code in an "high level" language which contains more of these "primitive commands" but then the code will be compiled into a set of instructions that the CPU can actually execute (i.e to the instruction set of the targeted CPU). If we were to try to write any sufficiently complex program using only the instruction sets of CPU's, it would become very complicated for humans to understand and would take a ridiculously long time.
Scanner misterscan = new Scanner(System.in);
int num1, num2, num3;
int [] temp = new int[3];
for (int k = 0; k < 3; k ++)
{
System.out.print("Enter num: ");
temp[k] = misterscan.nextInt();
}
Arrays.sort(temp); //Uses merge sort, and since I am lazy I cheated.
num1 = temp[0];
num2 = temp[1];
num3 = temp[2];
What is meant by definition based algorithm?
algorithm is a finite sequence of instructions, an explicit, step-by-step procedure for solving a problem, often used for calculation and data processing.
How is the precedence of operators in an expression overridden in most languages?
Precedence of operators in an expression overridden by the use of parentheses
What is the value of a variable?
A variable can have lots of different values - as opposed to a constant which has only one. That is why it is called a variable!
What is required to convert a high level language into machine language so as to execute it later?
we need compiler to convert high level language in to machine language
How do you write a javascript to swap two numbers without using third one?
By using the algorithm of bitwise EORing (Exclusive ORing) the numbers together:
If the two numbers are X and Y, then to swap them:
X = X EOR Y
Y = Y EOR X
X =X EOR Y
will swap them.
With knowledge of that algorithm, one then uses the syntax of Javascript to implement it.