1. #include
typedef int CommVault;
typedef CommVault CommVaultindia;
void main () {
CommVaultindia val= 234;
printf("%d ", val);
}
Answer: 234
Explanation:Here is no explanation for this answer
Workspace
Commvault
2. What is output or the error in the program if the command line data is?
CornmVault India
#include
int main(int argc, char *argv[]) {
printf(" %d", printf("%s", argv[1]));
return 0;
}
Answer: CommVault 9
Explanation:Here is no explanation for this answer
Workspace
Commvault
3. What is the output of the program on a 32 bit Operating System?
#include
#include
void main () {
double val = 12.34;
double *dp = &val;
char *cp;
cp = (char*)malloc(sizeof(char) * 20);
sprintf (cp, "hello world");
printf("%d %d %d", sizeof(cp), sizeof(dp), sizeof(val));
}
Answer: 4 4 8
Explanation:Here is no explanation for this answer
Workspace
Commvault
4. Match the following?
i) Software Interrupt mechanism (l)Deadlock
ii) Passing data from one process to another process (2)Signals
iii) A situation wherein two or more competing actions (3)Preemptive multitasking
are waiting for the other to finish, and thus
neither ever does
iv) Allows the computer system to more reliably guarantee each process a regular slice of operating time (4)Pipe
Answer: i-4, ii-3, iii-2, iv-1
Explanation:Here is no explanation for this answer
Workspace
Commvault
5. #include
int main () {
int ( *Commprintf) (const char*, ... ) = printf;
Commprintf ( "Hello World");
return 0;
}
Answer: Hello World
Explanation:Here is no explanation for this answer
Workspace
Commvault
6. What is output or the error in the program?
#include
void main () {
const char* cptr = "Hello";
printf ("%c", (*++cptr)++);
}
Answer: l-value specifies const object
Explanation:Here is no explanation for this answer
Workspace
Commvault
7. #include
void main () {
struct {
float c ,
union p {
char c;
char *cp;
short s;
} uvar[5);
} svar [6];
printf("%d %d", &svar[2], &svar[5]);
}
Answer: 1244944 1245016
Explanation:Here is no explanation for this answer
Workspace
Commvault
8. #include
using namespace std;
void fun(int a, int b, int &c,int &d)
{
c += a + b;
d += a - b;
}
int main () {
int vl = 5, v2 = 10, v3 = 2, v4 = 3;
fun(vl, v2, v3, v4);
cout << v3 << " "<< v4 ;
return 0;
}
Answer: 17 -2
Explanation:Here is no explanation for this answer
Workspace
Commvault Societe Generale
9. #include
using namespace std;
class test {
float x, y;
public:
test(float a = 1.0, float b = 2.0)
{
x = a;
y = b;
}
test operator + (test & obj) {
return test(this->x + obj.x, y + obj.y);
}
operator float () {
return (x + y) ;
}
};
int main () {
test obj1(1.23, 4.56), obj2;
obj2 = obj1 + obj2;
cout << obj2;
return 0;
}
Answer: 8.79
Explanation:Here is no explanation for this answer
Workspace
Commvault Sopra Steria
10. What is the signature of the assignment operator in C++, if chain of assignments need to be performed for an object of class test?
Answer: test & operator = (const test&);
Explanation:Here is no explanation for this answer
Workspace
Commvault