Which of the following class access protected and private members of other class?
Friend class
Virtual class
Main class
None of these
Answer: Option A.
Thers is more coupling between classes.
What is output of following code fragment?
int val,res,n=1000;
val=2000;
res=n+val>1750?400:200;
cout<< res;
200
400
800
100
Answer: Option B.
because the arithmetic operator + has higher precedence than ? : operator thus the condition before ? is taken as (n+val) and (1000+2000) > 1750 is true.
What is a minimal super key in DBMS?
Candidate key
Primary key
Secondary key
None of these
Answer: Option A.
What is the output of following program?
#include
struct Pixel{int C,R;};
void Display (pixel P) {
cout<< "Col" << P.C << "Row"<< P.R << endl; }
int main()
{ Pixel X = {40,50},Y,Z;
Z=X;
X.C += 10;
Y=Z;
Y.C += 10;
Y.R += 20;
Z.C -= 15;
QUESTION
return 0; }
What is the output if it replace QUESTION with Display(X);
Col 50 Row 70
Col 50 Row 50
Col 70 Row 70
None of these
Answer: Option B.
What is the output if it replace QUESTION with Display(Y);