Question

C program help Considering the following declaration of an array: float itemPrice[SIZE]; Which of the pointers...

C program help

Considering the following declaration of an array:
float itemPrice[SIZE];
Which of the pointers declared below can be used to access elements of the array
without explicit type casting?
(A) char *ptrA;
(B) float *ptrB;
(C) float **ptrC;
(D) double *ptrD;
(E) None of the above

Ans: D?
What is the most appropriate function prototype for funct1 in the following C++ code
fragment?
int data1[]={5,2,8,7}, data3;
float data2 = 3.5;
data3 = funct1(datal, data2)
(A) int funct1(int, int);
(B) int funct1(int[], float);
(C) float funct1(float&, int);
(D) void funct1(int&, float);
(E) float funct1(float[], int);

Ans:B?
The following code fragment is from the implementation of a linked list:
while(current->next != NULL)
current = current->next;
current->next = newnode;
This code fragment . . .
(A) adds a node to the head of a linked list.
(B) adds a node to the tail of a linked list.
(C) finds a specific node in a linked list.
(D) destroys all nodes in a linked list.
(E) makes a copy of a linked list.
Ans: E?

0 0
Add a comment Improve this question Transcribed image text
Answer #1


float itemPrice[SIZE];
Answer:B
(B) float *ptrB;

This statement is used to declare ptrB as a pointer variable that points to floating point value.Because arrray elements are stored in contiguous memory locations , we can make pointer to point to the first element of array and increment the pointer to point to second element , third element and so on.

------------------------------------------------


What is the most appropriate function prototype for funct1 in the following C++ code
fragment?
int data1[]={5,2,8,7}, data3;
float data2 = 3.5;
data3 = funct1(datal, data2)

(B) int funct1(int[], float);
Ans:B ,

yes its return value data3 is integer, and parameter1 data1[ ] is integer array and parameter 2 , data2 is float value holds 3.5.

------------------------------------------------------
The following code fragment is from the implementation of a linked list:
while(current->next != NULL)
current = current->next;
current->next = newnode;
Answer :option B
(B) adds a node to the tail of a linked list.
While loop is used to move the current pointer from a position to the end of the list , current pointer moves until current->next!=null.

if it is null, exits from loop , current pointing to the last node of the list

current->next=new node; this statement sets the newnode after the last node, so it adds a node to the tail of a linked list.

Add a comment
Know the answer?
Add Answer to:
C program help Considering the following declaration of an array: float itemPrice[SIZE]; Which of the pointers...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT