11. char *buff, *data;
void main ()
{
const char* const cp = buff;
cp = data; // Line 5
*cp='a'; // Line 6
}
Answer: Both Line 5 and Line 6
Explanation:Here is no explanation for this answer
Workspace
Commvault Sopra Steria
12. #include
using namespace std;
#define SQ(a) a*a
inline int square(int a)
{
return a*a;
}
int main () {
int i, j, k, l;
i = SQ(2 + 3);
j = square(2 + 3);
k = SQ(6 - 1);
l = square(6 - 1);
cout << i << " "<< j << " "<< k << " " << l;
return 0;
}
Answer: 11 25 -1 25
Explanation:Here is no explanation for this answer
Workspace
Commvault
13. Which statement is wrong in C++?
Answer: The inline specifier instructs the compiler to replace function calls with the code of the function body
Explanation:Here is no explanation for this answer
Workspace
Commvault
14. Which of the following programming technique/structures are not good for demand paged environment?
Answer: Binary Search
Explanation:Here is no explanation for this answer
Workspace
Commvault Global Edge
15. Which of the following statement is incorrect?
Answer: Volatile storage can survive system crashes or system power down.
Explanation:Here is no explanation for this answer
Workspace
Commvault Global Edge
16. Consider the following program which comprises three source files main.c, fl.c, f2.c? What is the output of the program?
#include
//test.c
void f1 ();
void f2();
static int a;
static int b;
void main()
{
f1 ();
f2();
printf("f5 = %d f6 = %d ", a, b );
}
//f2.c
int a;
int b;
void f2(){
printf("f3 = %d f4 = %d ", a,b);
}
//f1 .c
extern int a;
extern int b;
void f1 ()
{
b = 6;
a= 5;
printf("f1 = %d f2 = %d ", a,b);
}
Answer: fl = 5 f2 = 6 f3 = 5 f4 = 6 f5 = 0 f6 = 0
Explanation:Here is no explanation for this answer
Workspace
Commvault
17. What are the number of nodes of left and right sub-tree of the binary tree if the data is inserted in the following order:\r\n 45, 15, 8, 5 6, 5, 65, 47, 12, 18, 10, 73, 50, 16, 61
Answer: 7 6
Explanation:Here is no explanation for this answer
Workspace
Commvault
18. Match the following with reference to the following program code.
#include
void main ()
{
int x [3][4] = {{1,6,9,12},{11,17,3,2},{20,23,4,5}};
int *n = &x;
}
(i) *(*(x + 1) + 1) (1) 9
(ii) *(*x + 1) + 3 (2) 13
(iii) *(n + 3) + 1 (3) 4
(iv) ++(*n++) + *n (4) 17
Answer: i - 4, ii - 3, iii - 2, iv - 1
Explanation:Here is no explanation for this answer
Workspace
Commvault
19. Consider the following code segment in C to traverse a binary tree using the preorder
typedef struct tree {
int info;
struct *left;
struct *right;
}node;
void preorder(node *tree)
{
if (t)
{
Statementl
Statement2
Statement3
}
}
The above Statements should be
Answer: printf("%d", tree->info); preorder(tree->left); preorder(tree->right);
Explanation:Here is no explanation for this answer
Workspace
Commvault Capgemini Societe Generale
20. Which of the following are true with respect to deadlock conditions?
1) Mutual exclusion: a resource that cannot be used by more than one process or thread at a time
2) Hold and wait: processes already holding resources may request new resources
3) No preemption: No resource can be forcibly removed from a process holding it, resources can be released only by the explicit action of the process
4) Circular wait: two or more processes form a circular chain where each process waits for a resource that the next process in the chain holds
Answer: All the 4 conditions
Explanation:Here is no explanation for this answer
Workspace
Commvault Societe Generale