9. Which of the following operator has the highest precedence?
(1)*
(2)==
(3)=>
(4)+
Ans : 4


If I have to answer that question, I will choose the answer *.
Does + has higher precedence than *?
Please explain me.

In the book I have read, * has higher precedence than +. But in the ture answer of that question is +. I think the answer is wrong.

Yes, you are right and your quiz master is wrong.
Where is this quiz, is it online somewhere?

EDIT: nvm i errd and missed part of his post :-X

Shocking - only 15 out of 20, surely some mistake....

1. Which of the following is an example of compounded assignment statement?
a = 5
a += 5
a = b = c
a = b
Ans : 2

Since K&R doesn't actually define the term "compounded assignment", one is left guessing as to what the hell they're talking about. Their answer is correctly called an assignment operator.

4. The operator / can be applied to
integer values
float values
double values
All of these
Ans : 2

Apparently, we're supposed to use something other than / for division of ints and doubles :icon_rolleyes:

9. Which of the following operator has the highest precedence?
*
==
=>
+
Ans : 4

Since => isn't actually an operator, I toyed with the idea that it was a typo and it really meant ->
Their "answer" comes in from left field and complete levels anyone with any competence in C.

16. What will be the output of the expression 11 ^ 5?
5
6
11
None of these
Ans : 2

Yet more trouble for anyone who actually knows the answer rather than some chimp guessing away.

Somewhat strangely, it is the "right" answer if you assume that the "11" is in binary, and the "5" is decimal, but that sure is a contrived way of screwing things up. It certainly wouldn't compile as an expression.

20. p++ executes faster than p+1 because
p uses registers
p++ is a single instruction
++ is faster than +
None of these
Ans : 2

I was bound to get this one wrong because the quizmaster has obviously got some weird implementation specific view of how the universe works. Nowhere in the standard does it state that ++ should be a single instruction, because there is no need for such a detail. Indeed, the very notion that ++ may be faster than +1 is flawed, since any half-decent compiler will render the same code for them anyway.

Yes, that is one of the poorer online C tests I've seen in a while. You'd do well to avoid it.

commented: i will make sure to avoid it as well! +6

http://www.indiastudycenter.com/update.htm
"IndiaStudyCenter.com makes no warranty that the contents of the Site are free from infection by viruses or anything else which has contaminating or destructive properties."
ROFLMAO - having read the questions in the quiz, that's not all that can be considered "harmful" :icon_biggrin:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.