Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following definition in C programming: typedef struct node{ int data; struct node* next; }Node; Which of the following statements should be used

 
image
image
image
image
image

Consider the following definition in C programming: typedef struct node{ int data; struct node* next; }Node; Which of the following statements should be used to create a new node? Select one: a. Node NewNode = (Node)malloc(sizeof(Node")); b. Node NewNode = (Node)malloc(sizeof(Node)); c. Node NewNode = (Node*)malloc(Node); d. Node NewNode = (Node)malloc(sizeof(Node)); Question 5 Not yet answered Marked out of 5.00 P Flag question What will the below function return for the following linked list? 1- >2->3->4->5->6 Note that head is a pointer to the first node. int Function(Node* head) { Node *ptr = head; int X = -3; ptr = ptr->next; ptr = ptr->next; while (ptr != NULL) { X += ptr->data; ptr = ptr->next; } return X; } Select one: a. 20 O O O d. 21 b. 15 c. 18 Question 7 Not yet answered Marked out of 5.00 P Flag question [5 points] Given the following function: int sum(int n) { if (n Question 8 Not yet answered Marked out of 5.00 P Flag question Consider the following recursive function: void Function List(struct Node* ptr){ if(ptr == NULL) return; printf("%d\t", ptr); FunctionList(ptr->next); } If Function List(head) is called, and the linked list is not empty, what will happen? Select one: O a. The elements will be printed from head to tail. b. An error message will be displayed. c. The function will be executed an "infinity" of times. d. The elements will be printed in reverse order. Question 9 Not yet answered Marked out of 5.00 P Flag question Consider the following code: void FunctionArray(int A[], int i, int n){ if (i==n) } return; printf("%d\t", A[i]); FunctionArray(A, i+1, n); Assume you have an array A of ten elements. If printArray(A, 5, 10) is called, what will happen? Select one: O a. A[9] will be printed an "infinity" of times. b. A[o] will be printed an "infinity" of times. c. The elements in the array will be printed from A[5] to A[9]. d. The elements in the array will be printed in reverse order from A[9] down to A[5]. Question 6 Hot yet answered Marked out of 5.00 Flag question Which of the following statements is correct: Select one: O a. Any problem that can be resolved recursively can also be resolved iteratively. Ob. A program is called iterative when a function calls itself. c. Omitting the base case in a recursive function does not cause infinite recursion. d. A program is called recursive when there is a loop (or repetition).

Step by Step Solution

3.29 Rating (152 Votes )

There are 3 Steps involved in it

Step: 1

Answer Question 3 d Node NewNode Node mallocsizeofNode Option 1 is incorrect because ... 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

Government and Not for Profit Accounting Concepts and Practices

Authors: Michael H. Granof, Saleha B. Khumawala

6th edition

978-1-119-4958, 9781118473047, 1118155971, 1118473043, 978-1118155974

More Books

Students also viewed these Programming questions