How do you write a program to find out largest number between two numbers using ternary operators?
// assume you want the find the largest of ints a,b,c:
int max = (a>b&&a>c?a:b>c?b:c);
C program for Sum of n number using if else statements?
// Why do you need if/else statements?
int main()
{
int numbers[] = {1, 2, 3, 4, 5, 6}; // and so on
int i;
int sum = 0;
for(i = 0; i < sizeof (numbers)/sizeof(int); i++)
sum += i;
return sum;
}
What are non alphanumeric values?
!@#$%^&*() basically they are any characters that do not contain the value of a number or a letter.
AnswerIt is data formatting that includes non-standard ASCII characters (characters not included on a standard English-language keyboard)All characters besides:
0123456789
abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
and those letters with accents and diacritical marks
and those letters in other alphabet systems
Where does global variables stored in C?
It depends entirely on what platform you are using.
In an embedded environment, for instance
global/static variables go into different RAM memory segments depending on whether or not they are initialised.
constants are often left in ROM
automatic variables are normally placed of the stack of the currently running task but not always.
By definition, only a hacker can hack an account. Someone trying but not succeeding is a wannabe hacker. Anyone else accessing an account will do so through regular credentials (such as pin and password combinations), although those might have been acquired illegitimately.
What is a c programming course?
C Programming Course, C Training, Learn C Programming www.traininghott.com/Courses/ANSI-C-Programming-Hands-On-C-...Course Description: This hands on C programming course provides a comprehensive introduction to the ANSI C language, emphasizing portability and ... C Tutorial
How many communication satellites are currently orbiting the earth?
The numbers vary among estimates, but there are between 2100 to 2200 functioning artificial satellites in Earth orbit. Russia has the greatest number at around 1324. The U.S. is second with 658 satellites in orbit.
When the user loads a program it is copied into before it is run?
RAM
It depends on the computer system being used. Traditionally an executable program would be copied in its entirety from its storage media (disk, diskette, tape, SD card, USB device, network storage) into memory (also called RAM for Random Access Memory). If it already is in a high speed ROM (read only memory) it might be executed directly from there or it might still be copied into RAM for execution. It depends on the capabilities of the rest of the hardware.
Systems with a swapping area might copy the program to the swap area and flag it for execution. When its turn comes, part of it are loaded into memory as needed and run.
Other systems don't even do that. They can just flag the program location on the disk drive as ready run. When its turn arrives, the needed parts of the program are copied to memory and run.
Function Pointers are basically used when we want to select a function which is to be used dynamically at run time.
AnswerFunction pointers are the only way for "Interept programming". In UNIX all the Interepts are called using function pointers. This is mainly used in system programming. Answerits nothing but a pointer to function. which is similar to ptr to a variable, if we are saying ptr to a variable then it will hold address of the variable like that fn. ptr will have the address of the function..one of the major application of the function pointer is call back function.. i.e callback.
AnswerPointers to functions/methods/subroutines aka 'Delegates' are frequently used in .NET programming especially in EventHandling, MemberInvoking<><><>
A function pointer is used to pass a function as an argument to another function, or to store a function as a data item, for example a list of functions can be implemented as an array of pointers to functions. Function pointers are used to store interrupt handlers in tables.
What is plus operator is it unary or binary?
There is no unary plus in C, but if there were, it would have only one operand, unlike the binary plus which has two:
x = a + b; /* binary plus */
x = + b; /* unary plus -- not in C*/
x = a - b; /* unary plus */
x = - b; /* unary minus */
How to remove duplicate values in an array?
The simplest way of doing this is not very efficient, but provides a quick development time. You want to take all of the elements of the array, add them to a Set, then retrieve them as an array again. Note that this will probably not preserve the order of elements in the array.
{
Object[] originalArray; // let's pretend this contains the data that
// you want to delete duplicates from
Set newSet = new HashSet();
for (Object o : originalArray) {
newSet.add(o);
}
// originalArray is now equal to the array without duplicates
originalArray = newSet.toArray();
}
Now the efficient, and more correct, solution.
This one will create a new array of the correct size without duplicates.
{
Object[] originalArray; // again, pretend this contains our original data
// new temporary array to hold non-duplicate data
Object[] newArray = new Object[originalArray.length];
// current index in the new array (also the number of non-dup elements)
int currentIndex = 0;
// loop through the original array...
for (int i = 0; i < originalArray.length; ++i) {
// contains => true iff newArray contains originalArray[i]
boolean contains = false;
// search through newArray to see if it contains an element equal
// to the element in originalArray[i]
for(int j = 0; j <= currentIndex; ++j) {
// if the same element is found, don't add it to the new array
if(originalArray[i].equals(newArray[j])) {
contains = true;
break;
}
}
// if we didn't find a duplicate, add the new element to the new array
if(!contains) {
// note: you may want to use a copy constructor, or a .clone()
// here if the situation warrants more than a shallow copy
newArray[currentIndex] = originalArray[i];
++currentIndex;
}
}
// OPTIONAL
// resize newArray (using _newArray) so that we don't have any null references
String[] _newArray = new String[currentIndex];
for(int i = 0; i < currentIndex; ++i) {
_newArray[i] = newArray[i];
}
}
---------
The second version is correct in theory. However, if you deal with large two- or more- dimensional arrays, you are in trouble, as with each new element in the destination array you will have to search through a greater number of elements.
This is especially true if you look for duplicates in more than one element of the array, for example looking in columns 'a' and 'b' of array
a1 b1 c1 d1
a2 b2 c2 d2
a3 b3 c3 d3
Drop in performance is unbelievable if you go over approx 1,000 records with majority or records being unique.
I am trying to test a couple of different approaches for large arrays. If anyone is interested, let me know, and I will keep you posted.
How is image resolution expressed?
Image resolution is usually expressed by giving the dimensions of the image in pixels. The size of an image that is 640 pixels wide and 480 pixels tall would be expressed as 640x480. 640x480 is read as "six forty by four eighty".
In procedural programming the programs are written as a list of instructions (procedures) which are written in a sequence, and where all programming is textual. In contrast, visual programming language uses graphics, animations....to manipulat programs without using texts....VLP is much easier than PP.
Can you declare a function in the body of another function in c language?
yes, we can not declare a function in the body of another function. but if we declare a function in the body of another function then we can call that very function only in that particular function in which it is declared; and that declared function is not known to other functions present in your programme. So if a function is required in almost all functions of your programme so you must declare it outside the main function i.e in the beginning of your programme.
What are the object features of pascal programming language?
Unlike C++, Pascal is a "safe" language. While it is possible to write incorrect programs, they can't harm more than themselves; they can't get a pointer into some other concurrently executing program and start changing values over there.
If you're considering Pascal, take a long hard look at Python or Ruby first. They are modern safe languages, suitable for teaching, which enjoy better support on modern systems than Pascal. They are also freely available.
What are the fields of a node in a linked list?
usually we have two fields they are data field and node i.e. pointer field.it also depends on type of linked list.the above said is for single linked list.And for double linked list it sontains three fields first pointer that pointes to previious node and data field and another pointer that point to next node
Advantages of object-oriented approach over structured approach of problem solving?
The object-oriented approach has the following advantages: when the expert system is large, complexity is reduced through modularization, that is, by subdividing the system into manageable size components, such as objects, and establishing well-defined relationships between them. The internal design of each object is localised so that it does not depend on the internal design of another component. The design concepts are separated from the implementation details.
That means that rules are developed separately from the objects that they manipulate. Objects can be reused. They are written and debugged once, and then matched to form new applications.
The advantage of separation of the various components is that each of these is autonomous. What should be well-managed are the relationships between them. Unlike the other systems that implement a rule-based system as a library in object-oriented language, this architecture extends this further by applying object technologies
to every single component of the expert system, including the rule base.
In which Language is Linux written?
Linux supports any written language: it understands Unicode natively, so it can display the characters of any language with the appropriate locales included.
As far as programming languages, Linux is written in C, but almost any language, from assembly to C to C++ to Python to Perl to .NET can be used on it.
What command is used to exit from the middle of a loop in Scilab?
As in most languages, a break statement is used to exit the nearest enclosing scope, including loops:
// Scilab example:
// Loop 5 times with a 50% chance of early termination on each iteration
for i=1:5
disp (i)
if rand (1,1)>0.5 then
break
end
end
// break jumps to this point
Do real time processingsystem process data instantly?
The advantages are; if you have a processor that can handle all the stress and load of using the processes as they are called up in real time then it works faster.
Disadvantages; puts a helluva lot of stress on your processor and if you have too many programs running without the necessary speed then your processor will overheat and might start to melt.
What is seventeen twentieths as a decimal?
Expressed as a decimal, 17/20 is equal to 0.85.
85% or 0.85
Is the array size is fixed after it is created?
Generally, a array is fixed in size. With some libraries, however, they are extensible, either by reallocation/copying strategies (C/C++/STL), or by linking/referencing strategies (JAVA).
What is a variable that is used within a function?
If the variable is declared within the function body, it is a local variable, one that is local to the function. Local variables fall from scope when the function returns, they are only accessible within the function. However, local variables can be returned by value, which creates an automatic variable that is returned to the caller. If the caller does not store the return value, the automatic variable falls from scope when the expression containing the function call ends. However, the expression may evaluate the return value without storing it. Note that functions cannot return local variables by reference since the local variable falls from scope when the function returns.
If the variable is passed as an argument to the function, then the variable is a parameter of the function. Arguments may be passed by value or by reference, depending upon the function signature. Passing by value means the function parameter is a copy of the argument (if the argument is an object, the object's copy constructor is invoked automatically). Thus any changes made to the parameter within the function are not reflected in the argument that was originally passed, and the parameter will fall from scope when the function returns. However, the value of the parameter can be returned as previously explained.
Passing by reference means the function parameter refers directly to the argument that was passed. Thus any changes made to the parameter are reflected in the argument.
Parameters that are declared as constant references assure the caller that the reference's immutable members will not be altered by the function. If the parameter is a non-const reference but the caller does not wish changes to be reflected in the argument, the caller should pass a copy of the argument instead.