Cpp Programming 10

COEP
Lets Crack Online Exam

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

Subject: Cpp Programming 10

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

 

Q1. What does the following statement mean? int (*fp)(char*)

a) pointer to a pointer

b) pointer to an array of chars

c) pointer to function taking a char* argument and returns an int

d) function taking a char* argument and returning a pointer to int

 

Q2. The operator used for dereferencing or indirection is ____

a) *

b) &

c) ->

d) ->>

 

Q3. Which of the following concepts means waiting until runtime to determine which function to call?

a) Data hiding

b) Dynamic casting

c) Dynamic binding

d) Dynamic loading

 

Q4. Choose the right option string* x, y;

a) x is a pointer to a string, y is a string

b) y is a pointer to a string, x is a string

c) both x and y are pointer to string types

d) none of the mentioned

 

Q5. Which one of the following is not a possible state for a pointer?

a) hold the address of the specific object

b) point one past the end of an object

c) zero

d) point to a tye

 

Q6. Which of the following is illegal?

a) int *ip;

b) string s, *sp = 0;

c) int i; double* dp = &i;

d) int *pi = 0; 

 

Q7. What will happen in this code? int a = 100, b = 200; int *p = &a, *q = &b; p = q;

a) b is assigned to a

b) p now points to b

c) a is assigned to b

d) q now points to a

 

Q8. The correct statement for a function that takes pointer to a float, a pointer to a pointer to a char and returns a pointer to a pointer to a integer is

a) int **fun(float**, char**)

b) int *fun(float*, char*)

c) int ***fun(float*, char**)

d) int ***fun(*float, **char)

 

Q9. What is meaning of following declaration? int(*p[5])();

a) p is pointer to function

b) p is array of pointer to function

c) p is pointer to such function which return type is array

d) p is pointer to array of function

 

Q10. When does the void pointer can be dereferenced?

a) when it doesn’t point to any value

b) when it cast to another type of object

c) using delete keyword

d) none of the mentioned

 

Q11. The pointer can point to any variable that is not declared with which of these?

a) const

b) volatile

c) both a & b

d) static

 

Q12. void pointer cannot point to which of these?

a) methods in c++

b) class member in c++

c) both a & b

d) none of the mentioned 

 

Q13. Reference is not same as pointer because

a) a reference can never be null

b) a reference once established cannot be changed

c) reference doesn’t need an explicit dereferencing mechanism

d) All of these

 

Q14. What we can’t do on a void pointer?

a) pointer arithemetic

b) pointer functions

c) both of the mentioned

d) none of the mentioned

 

Q15. Void pointer can point to which type of objects?

a) Int

b) float

c) double

d) all of the mentioned

 

Q16. When does the void pointer can be dereferenced?

a) when it doesn’t point to any value

b) when it cast to another type of object

c) using delete keyword

d) none of the mentioned

 

Q17. The pointer can point to any variable that is not declared with which of these?

a) const

b) volatile

c) both a & b

d) static

 

Q18. Generic pointers can be declared with__________

a) auto

b) void

c) asm

d) None of these

 

Q19. Which of the followings is/are pointer-to-member declarator?

a) ->*

b) .*

c) ::*

d) both a and b 

 

Q20. Which of the following are member dereferencing operators in CPP? 

1. *  

2. :: 

3. ->* 

4. ::* 

5. ->

a) Only 1, 3, 4

b) Only 1 and 5

c) Only 3 and 4

d) Only 3,4,5 

 

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

 

Q1. Answer: c

 

Q2. Answer: a

 

Q3. Answer: c

 

Q4. Answer: a

 

Q5. Answer: d

 

Q6. Answer: c

 

Q7. Answer: b

 

Q8. Answer: c

 

Q9. Answer: b

 

Q10. Answer: b

 

Q11. Answer: c

 

Q12. Answer: b

 

Q13. Answer: d

 

Q14. Answer: a

 

Q15. Answer: d

 

Q16. Answer: b

 

Q17. Answer: c

 

Q18. Answer: b

 

Q19. Answer: c

 

Q20. Answer: a