Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1)Which of the following is the proper declaration of a pointer? a) int p; b) int &p; c) ptr p; d) int *p; 2)Which of

1)Which of the following is the proper declaration of a pointer?

a) int p;

b) int &p;

c) ptr p;

d) int *p;

2)Which of the following gives the memory address of integer variable x?

a) *x

b) x

c) &x

d) address (x)

3)What is wrong with these statements: int *ptr; * ptr = 5;

a) A pointer can not pont to a type of integer

b) *ptr = 5; is not the right way to reference a pointer to update the value it is pointing to

c) A pointer must be initialized to a valid address before referencing it

d) There is nothing wrong with these statements, they will execute fine with no issues

4)Which of the following provides the value stored at the address pointed to by the pointer called ptr?

a) ptr

b)value (ptr)

c) * ptr

d) &ptr

5)Which statement declares and initializes a pointer to an address of a character?

a) char char_ptr = &c;

b) char *char_ptr = &c;

c) both a and b

d) none of the above

6)When precedence is applied, which is an equivalent statement to: i2 = *p1 / 2 + 10;

a) i2 = ((*p1) / 2 ) + 10;

b) i2 = (p1 * 2 ) + 10;

c) i2 = (*p1) / ( 2 + 10);

d) none of the above

7)Which is a valid way to to reference a member called id_number of a structure using a pointer to a structure variable named emp_ptr?

a) (*emp_ptr).id_number = 98401;

b) emp_ptr -> id_number = 98401;

c) Both a and b

d) none of the above

8)C has a specific pointer type, such as: pointer int_ptr;

a) True

b) False

9)A properly declared pointer in C can reference any element of an array, assuming the pointer is declared to point to same type as the array type

a) True

b) False

10)A pointer is passed by value to a function

a) True

b) False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions