-
Efficient Sorting Method
If we add a element to the last of a sorted sequence. Then which of the sorting method will be most efficient to sort the new sequence?
-
Execute C Program
How will you execute a file from another C program through C programming without system command?
-
Inheritance
Which one of the following statements regarding C++ class inheritance is FALSE? a. Inheritance promotes generic design and code reuse.b. Struct cannot be inherited in C++. c. C++ supports multiple inheritance. d. Inheritance is a mechanism through which a subclass inherits the properties and behavior of its superclass.
-
Reallocating memory
When reallocating memory if any other pointers point into same piece of memory do you have to readjust these pointers or do they get readjusted automatically?
-
Virtual Functions
Explain the virtual table generated in memory at the time of declaration of virtual function?
-
What will be difference b/w 5th and 6th statements?
1. #define MAX 1002. main()3. {4. int max=100;5. int a[MAX];6. int b[max];7. }
-
Difference between reference and pointer?
what is difference between reference and pointer or pass by reference and pass by pointer?
-
-
-
-
-
-
Given the values of two nodes in a *binary search tree*, write a cprogram to find the lowest common ancestor. You may assume that bothvalues already exist in the tree.The function prototype is as follows:int FindLowestCommonAncestor(node* root,int value1,int value) 20 / 8 22 / 4 12 / 10 14I/P : 4 and 14O/P : 8(Here the common ancestors of 4 and 14, are {8,20}. Of {8,20}, the lowest one is 8).
One of the solution can be to find out postorder traversal taking each node one by one. This postorder function should return true if both the values (v1 & v2) are found in the postorder traversal of the given node. NOTE: The given tree is a BST.... think over it......
-
-
-
-
-
-
-
-
}
plz simplify the statement the 2 .when i run program gives undefined symbol p..but in a/c mcq that is correct ..say collect address of i ..how?? ">1)what is RTTI in c++?2)main(){ int i=10; int &p=i; //statement 2printf("%d %d"i,p);}plz simplify the statement the 2 .when i run program gives undefined symbol p..but in a/c mcq that is correct ..say collect address of i ..how??
-
-
-
-
-
-
In the following code, what is p2? typedef int* ptr ptr p1, p2;
A) an integer B) an integer pointerC) a pointerD) None of the above
-
-
-
-
-
-
}
">main(){ int i, j, *p; i = 25; j = 100; p = &i; // Address of i is assigned to pointer p printf("%f", i/(*p) ); // i is divided by pointer p}
A) Compile errorB) 1.00000C) Runtime error.D) 0.00000Explanation: Error because i/(*p) is 25/25 i.e 1 which is int & printed as a float, so abnormal program termination, runs if (float) i/(*p) -----> Type Casting.
-
printf(" %d", sizeof(u.a));
// printf("%d", sizeof(u.a[4].i));
}
">union u{ union u { int i; int j; }a[10]; int b[10];}u;main(){ printf("n%d", sizeof(u)); printf(" %d", sizeof(u.a));// printf("%d", sizeof(u.a[4].i));}
A) None of the AboveB) 1, 100, 1C) 40, 4, 4D) 4, 4, 4Explanation: 20, 200, error for 3rd printf
-
-
}
">vii)7. main(){ int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m);}
0 0 1 3 1Explanation :Logical operations always give a result of 1 or 0 . And also the logical AND (&&) operator has higher priority over the logical OR (||) operator. So the expression ‘i++ && j++ && k++’ is executed first. The result of this expression is 0 (-1 && -1 && 0 = 0). Now the expression is 0 || 2 which evaluates to 1 (because OR operator always gives 1 except for ‘0 || 0’ combination-...
-
-
A structure pointer is defined of the type time. With 3 fields min, sec hours having pointers to integers.Write the way to initialize the 2nd element to 10.
QUESTION 8In the above question an array of pointers is declared.Write the statement to initialize the 3rd element of the 2 element to 10;
-
What is the difference between NULL and NUL?
NULL is a macro defined in <stddef.h> for the null pointer. NUL is the name of the first character in the ASCII character set. It corresponds to a zero value. There’s no standard macro NUL in C, but some people like to define it. The digit 0 corresponds to a value of 80, decimal. Don’t confuse the digit 0 with the value of ‘’ (NUL)! NULL can be defined as ((void*)0), NUL as ‘’.
-
When would you use a pointer to a function?
Pointers to functions are interesting when you pass them to other functions. A function that takes function pointers says, in effect, “Part of what I do can be customized. Give me a pointer to a function, and I’ll call it when that part of the job needs to be done. That function can do its part for me.” This is known as a “callback.” It’s used a lot in graphical user interface libraries, in which...
-
How do you print only part of a string?
/* Use printf() to print the first 11 characters of source_str. */ printf(“First 11 characters: ‘%11.11s’n”, source_str);
-
How can type-insensitive macros be created?
A type-insensitive macro is a macro that performs the same basic operation on different data types. This task can be accomplished by using the concatenation operator to create a call to a type-sensitive function based on the parameter passed to the macro. The following program provides an example: #include <stdio.h> #define SORT(data_type) sort_ ## data_type void sort_int(int** i); void sort_long(long**...
-
How do you redirect a standard stream?
Most operating systems, including DOS, provide a means to redirect program input and output to and from different devices. This means that rather than your program output (stdout) going to the screen; it can be redirected to a file or printer port. Similarly, your program’s input (stdin) can come from a file rather than the keyboard. In DOS, this task is accomplished using the redirection characters,...