Cpp Programming 17

COEP
Lets Crack Online Exam

IT Interview Exam Questions: Cpp Programming 17 (IT Interview Exam Question, IT Campus Placement)

Subject: Cpp Programming 17

Part 17: List for questions and answers of C ++ Language

 

Q1. Which of the following statement is correct?

a) A reference is stored on heap

b) A reference is stored on stack

c) A reference is stored in a queue

d) A reference is stored in a binary tree

 

Q2. Which of the following statements is correct?

1.Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.

2.A reference is not a constant pointer.

a) Only 1 is correct

b) Only 2 is correct

c) Both 1 and 2 are correct

d) Both 1 and 2 are incorrect

 

Q3. Functions can be declared to return a reference type. There are reasons to make such a declaration/Which of the following reasons are correct?

1.The information being returned is a large enough object that returning a reference is more efficient than returning a copy.

2.The type of the function must be a R-value.

a) Only 1 is correct

b) Only 2 is correct

c) Both 1 and 2 are correct

d) Both 1 and 2 are incorrect

 

Q4. Which of the following statements is correct?

1.Change a reference changes the referent.

2.We can create an array of references.

a) Only 1 is correct

b) Only 2 is correct

c) Both 1 and 2 are correct

d) Both 1 and 2 are incorrect

 

Q5. Which of the following statement is correct about the references?

a) A reference must always be initialized within functions

b) A reference must always be initialized outside all functions

c) A reference must always be initialized

d) Both A and C 

 

Q6. A reference is declared using the _____ symbol

a) &&

b) &

c) ||

d) !

 

Q7. Which of the following statements is correct?

1.A reference is not a constant pointer.

2.A referenced is automatically de-referenced.

a) Only 1 is correct

b) Only 2 is correct

c) Both 1 and 2 are correct

d) Both 1 and 2 are incorrect

 

Q8. Which of the following statements is correct?

1.An array of references is acceptable.

2.We can also create a reference to a reference.

a) Only 1 is correct

b) Only 2 is correct

c) Both 1 and 2 are correct

d) Both 1 and 2 are incorrect

 

Q9. Which of the following statement is correct?

a) A referenced has to be de-referenced to access a value

b) A referenced does not need to be de-referenced to access a value

c) A referenced has to be double de-referenced to access a value

d) Whether a reference should be de-referenced or not depends on the type of the reference

 

Q10. Which of the following statements is correct?

1.Once the variable and the reference are linked they are tied together.

2.Once the reference of a variable is declared another reference of that variable is not allowed.

a) Only 1 is correct

b) Only 2 is correct

c) Both 1 and 2 are correct

d) Both 1 and 2 are incorrect 

 

Q11. Which of the following statements is correct?

1.We can return a global variable by reference.

2.We cannot return a local variable by reference.

a) Only 1 is correct

b) Only 2 is correct

c) Both 1 and 2 are correct

d) Both 1 and 2 are incorrect

 

Q12. Reference is like a _____

a) Pointer

b) Structure

c) Macro

d) Enum

 

Q13. Which of the following statement is correct?

a) A reference is a constant pointer

b) A reference is not a constant pointer

c) An array of references is acceptable

d) It is possible to create a reference to a reference

 

Q14. Which of the following statement is correct?

a) A reference is declared using * operator

b) Once a reference variable has been defined to refer to a particular variable it can refer to any other variable

c) A reference must always be initialized within classes

d) A variable can have multiple references

 

Q15. Which of the following statement is correct?

a) An array of references is acceptable

b) Once a reference variable has been defined to refer to a particular variable it can refer to any other variable

c) An array of references is not acceptable

d) Reference is like a structure

 

Q16. Which of the following statements is correct?

1.Pointer to a reference and reference to a pointer both are valid.

2.When we use reference, we are actually referring to a referent.

a) Only 1 is correct

b) Only 2 is correct

c) Both 1 and 2 are correct

d) Both 1 and 2 are incorrect 

 

Q17. Which value we cannot assign to reference?

a) integer

b) floating

c) unsigned

d) null

 

Q18. Identify the incorrect statement

a) reference is the alternate name of the object

b) A reference value once defined can be reassigned

c) A reference value once defined cannot be reassigned

d) none of the mentioned

 

Q19. Which reference modifier is used to define reference variable?

a) &

b) $

c) #

d) none of the mentioned

 

Q20. Which of the following statement is correct?

a) Once a reference variable has been defined to refer to a particular variable it can refer to any other variable

b) A reference is indicated by using && operator

c) Once a reference variable has been defined to refer to a particular variable it cannot refer to any other variable

d) A reference can be declared beforehand and initialized later 

 

Part 17: List for questions and answers of C ++ Language

 

Q1. Answer: b

 

Q2. Answer: d

 

Q3. Answer: c

 

Q4. Answer: a

 

Q5. Answer: c

 

Q6. Answer: b

 

Q7. Answer: b

 

Q8. Answer: d

 

Q9. Answer: b

 

Q10. Answer: a

 

Q11. Answer: b

 

Q12. Answer: a

 

Q13. Answer: a

 

Q14. Answer: d

 

Q15. Answer: c

 

Q16. Answer: c

 

Q17. Answer: d

 

Q18. Answer: b

 

Q19. Answer: a

 

Q20. Answer: c