I have answered few multiple choice questions.I am sure i have answered almost 95% correctly.

Maybe you guys can identify if i have committed any mistakes.Just identify not solve.I will solve them myself.Just a hint what is wrong would help as i want to be sure all answers are perfect.

Below is the download link for questions.I have uploaded them to a word file because i thought posting those questions here would make this place clumsy..
Download link:-
http://rapidshare.com/files/234624786/CMCQ.doc.html

Hope you guys can help me correct my mistakes..

Somebody may have a look if you attach the document (though I'm not sure since it's multiple choice questions) but no one will have a look if they have to download it from rapidshare.

>I have uploaded them to a word file because i thought posting
>those questions here would make this place clumsy..
We're lazy. If we have to download an attachment or (horrors!) go to rapidshare, we'll just pass your thread by and answer another one. Unless there are hundreds of questions, posting them won't make this place "clumsy", whatever that's supposed to mean.

rapidshare is probably the worst possible place to "host" a document.

post your questions here, and we'll look at it.

Ok guys these three questions doubts.Rest i am sure i am correct.ANswers in red,
typedef struct
{
char name[20];
int id;
double salary;
} emprec_t;
. . .
emprec_t emp1, emp2;
char ch1;
int flag1, flag2;

Given this prototype of a user-defined function emp_nine,

void emp_nine(int num, emprec_t *employp)

How would you assign the value of num to the id component of the function's output parameter?
A) employp.id = num;
B) *employp.id = num;
C) &employp.id = num;
D) employp→id = num;
E) none of the above


The value of the expression cout << pipeflow is _____.
A) cout
B) pipeflow
C) true if output is successful, false otherwise
D) the number of characters output

If bin_inp is a pointer to an open binary input file and list is a 100-element array of type double, what single statement will copy up to 100 values from the file into the array and will save in list_size the number of values copied?
A) list_size = fscanf(bin_inp, "100%lf", list);
B) fread(&list, &list_size, sizeof (double), 100, bin_inp);
C) fscanf(bin_inp, "%lf", &list, &list_size, 100);
D) list_size = fread(list, sizeof (double), 100, bin_inp);
E) none of the above

>D) employp→id = num;
Correct.

>B) pipeflow
Incorrect. The correct answer isn't quite right either, but it's close enough.

>E) none of the above
Incorrect.

Thanks i knew something was fishy....But can you tell me what exactly is the pipeflow thing.I have the question and it is neither declared as a variable type or anything.What is it?

>But can you tell me what exactly is the pipeflow thing.
It's an object of a type that implements operator<< or a built-in type that std::ostream supports natively. Without seeing it declared (and possibly defined), you can't tell because the << operator is designed to figure out the type automagically.

Ok i will google this thing.I am not very good at handling files except from performing basics like reading writing and appending to text or binary files.

Thanks for this help.It would be great if you can go through thse answers too

Which reference could mean: - Follow the pointer in stemp to a structure. - Select the component named nums (this component is an array). - Reference element 4 of the array.
A) stemp.nums[4]
B) *stemp.nums[4]
C) (*stemp).nums[4]
D) *(stemp.nums)[4]
E) none of the above
typedef struct
{
char name[20];
int id;
double salary;
} emprec_t;
. . .
emprec_t emp1, emp2;
char ch1;
int flag1, flag2;

To call a user-defined function emp_change passing emp1 as an output argument, one would write:
A) emp_change(emp1);
B) emp_change(*emp1);
C) emp1 = emp_change();
D) emp_change(&emp1);
E) none of the above

Just tell me like i dont think you have answered the following answers correctly and i will rethink my answers.Thats all the help i need.If you add some explanation also that would be of great appreciation too.

^ the second one (emp_change) is incorrect.

consider the three basic parameters for a function: inputs are passed to the function. outputs are passed back from the function. return values are assigned by the function.

to get an output, you want the "called" function to modify an element held by the "calling" function. to do this, you generally must "pass-by-reference"

see this site for a good intro on passing by reference.

>^ the second one (emp_change) is incorrect.
Are you sure? The question is too vague to answer because multiple answers could be correct depending on the prototype.

[edit]
Nevermind. I just noticed I was in the C forum.
[/edit]

well, good point. even though we are in the C-forum, and my answer is correct for C language... one of his other questions did use C++ syntax.

so there could be some confusion. for C++ i don't think there's a single correct answer, is there?

This article has been dead for over six months. Start a new discussion instead.