I need help on this Systems review please! it's due by midnight monday.
Question 1
Not yet answered
Points out of 1.00
Flag question
Question text
Using these declarations:
int * numberPointers[3];
int * pointer;
int number;
Which of the following statements would generate a warning or
error?
Select one:
a. number = pointer;
b. *pointer = number;
c. pointer = numberPointers;
d. numberPointers[2] = &number;
e. a., b., and d.
f. a. and c.
Question 2
Not yet answered
Points out of 1.00
Flag question
Question text
Using these declarations:
int * numberPointers[3];
int * pointer;
int number;
Which of the following statements would generate a warning or
error?
Select one:
a. numberPointers[2] = pointer;
b. *pointer = numberPointers[2];
c. pointer = numberPointers[2];
d. *pointer = *numberPointers[2];
e. b. and d.
f. a. and c.
Question 3
Not yet answered
Points out of 1.00
Flag question
Question text
Consider the following struct definitions:
typedef struct
{
char departmentCode[4];
int courseNum;
int courseSec;
int studentCount;
} ClassType;
ClassType allClasses[SIZE];
ClassType * ptr = allClasses;
Which of the following would be a correct body for the for loop
below to initialize the departmentCode of each class to "C
S"?
for (i = 0; i < SIZE; i++)
{
<missing body>
}
Select one:
a. strncpy(allClasses[i].departmentCode, "C S", 4);
b. strncpy(allClasses.departmentCode[i], "C S", 4);
c. strncpy(allClasses[i].departmentCode, "C S", 3);
d. strncpy(ptr->departmentCode, "C S", 4); ptr++;
e. strncpy((*ptr).departmentCode, "C S", 4); ptr++;
f. a., d., and e.
g. b., c., and d.
h. all of these are correct
Question 4
Not yet answered
Points out of 1.00
Flag question
Question text
Consider the following struct definitions:
struct Class1
{
char departmentCode[4];
int courseNum;
int courseSec;
int studentCount;
} Class2;
typedef struct
{
char departmentCode[4];
int courseNum;
int courseSec;
int studentCount;
} Class3;
How are Class2 and Class3 alike or different?
Select one:
a. Class3 is an instance of a struct and Class2 is the name of a type
b. Class2 and Class3 are both the names of types
c. Class2 and Class3 are both instances of a struct
d. Class2 is an instance of a struct and Class3 is the name of a type
Question 5
Not yet answered
Points out of 1.00
Flag question
Question text
Consider the following struct definitions:
struct Class2
{
char departmentCode[4];
int courseNum;
int courseSec;
int studentCount;
} aClass;
typedef struct
{
char departmentCode[4];
int courseNum;
int courseSec;
int studentCount;
} Class;
Which of the following would cause the compiler to generate an
error or warning?
Select one:
a. aClass.courseNum = 3490;
b. Class.courseNum = 3490;
c. aClass->courseNum = 3490;
d. (*Class).courseSec = 101;
e. aClass.courseSec = 101;
f. b. and d.
g. b., c., and d.
Question 6
Not yet answered
Points out of 1.00
Flag question
Question text
Consider the following struct definitions.
struct node
{
int value;
struct node * next;
};
typedef struct node nodeType;
typedef struct
{
int count;
nodeType * first;
} listType;
How would you declare a variable that is one of the second
structs?
Select one:
a. struct listType * list;
b. listType * list;
c. listType list;
d. struct nodeType * list;
e. struct listType list;
Question 7
Not yet answered
Points out of 1.00
Flag question
Question text
Consider the following struct definitions.
struct node
{
int value;
struct node * next;
};
typedef struct node nodeType;
typedef struct
{
int count;
nodeType * first;
} listType;
Suppose that list is a listType pointer. What is the syntax to set
the count field of the listType data item pointed to by list to
0?
Select one:
a. list.count = 0;
b. list->count = 0;
c. *list.count = 0;
d. (*list).count = 0;
e. b. and c.
f. b. and d.
Question 8
Not yet answered
Points out of 1.00
Flag question
Question text
Consider the following struct definitions.
struct node
{
int value;
struct node * next;
};
typedef struct node nodeType;
typedef struct
{
int count;
nodeType * first;
} listType;
Suppose that list is a listType pointer. What is the syntax to set
the first field of the listType data item pointed to by list to
NULL?
Select one:
a. list.first = 0;
b. list->first = NULL;
c. *list.first = NULL;
d. (*list).first = NULL;
e. b. and c.
f. b. and d.
Question 9
Not yet answered
Points out of 1.00
Flag question
Question text
Consider the following struct definitions.
struct node
{
int value;
struct node * next;
};
typedef struct node nodeType;
typedef struct
{
int count;
nodeType * first;
} listType;
Suppose that list is a listType pointer and nodePtr is a nodeType
pointer. What is the syntax to set the first field of the listType
data item so that it points to the same thing that nodePtr points
to?
Select one:
a. list.first = nodePtr
b. (*list).first = nodePtr;
c. list.first = *nodePtr;
d. list->first = *nodePtr;
e. *list.first = nodePtr;
Question 10
Not yet answered
Points out of 1.00
Flag question
Question text
Consider the following struct definitions.
struct node
{
int value;
struct node * next;
};
typedef struct node nodeType;
typedef struct
{
int count;
nodeType * first;
} listType;
Suppose that list is a listType variable and that nde is a nodeType
variable. What is the syntax for setting the first field of list so
that it points to nde?
Select one:
a. list.first = &nde;
b. (*list).first = nde;
c. list->first = nde;
d. *list.first = nde;
e. *(list.first) = nde;
Question 11
Not yet answered
Points out of 1.00
Flag question
Question text
Consider the following struct definitions.
struct node
{
int value;
struct node * next;
};
typedef struct node nodeType;
typedef struct
{
int count;
nodeType * first;
} listType;
Suppose that list is a listType variable and its first field is set
to the address of a nodeType variable. What is the syntax for using
list to set the value field of the nodeType variable to 3?
Select one:
a. *list.first->value = 3;
b. *(list.first).value = 3;
c. list->first->value = 3;
d. list.first->value = 3;
e. (*list).first ->value = 3;
Question 12
Not yet answered
Points out of 1.00
Flag question
Question text
Consider the following struct definitions.
struct node
{
int value;
struct node * next;
};
typedef struct node nodeType;
typedef struct
{
int count;
nodeType * first;
} listType;
Suppose that list is a listType variable and its first field is set
to the address of a nodeType variable. What is the syntax for using
list to set the next field of the nodeType variable to NULL?
Select one:
a. list->first->next = NULL;
b. list.first->next = NULL;
c. (*list).first ->next = NULL;
d. *list.first->next = NULL;
e. *(list.first).next = NULL;
Question 13
Not yet answered
Points out of 1.00
Flag question
Question text
Consider the following struct definitions.
struct node
{
int value;
struct node * next;
};
typedef struct node nodeType;
typedef struct
{
int count;
nodeType * first;
} listType;
Suppose that list is a listType variable and its first field is set
to the address of a nodeType variable. Suppose nde is a nodeType
variable. What is the syntax for using list to set the next field
of the nodeType variable so that it points to nde?
Select one:
a. list->first->next = nde;
b. *(list.first).next = &nde;
c. *list.first->next = nde;
d. (*list).first ->next = nde;
e. list.first->next = &nde;
Question 14
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program?
#include <stdio.h>
void foo(int n);
int main()
{
int n = 3;
foo( n );
printf("%d", n);
}
void foo(int k)
{
k = k * k;
}
Answer:
Question 15
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program?
#include <stdio.h>
void foo(int n);
int main()
{
int n = 3;
foo( n );
printf("%d", n);
}
void foo(int n)
{
n= n * n;
}
Answer:
Question 16
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program?
#include <stdio.h>
int foo(int n);
int main()
{
int n = 3;
n = foo( n );
printf("%d", n);
}
int foo(int k)
{
return k * k;
}
Answer:
Question 17
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program?
#include <stdio.h>
void foo(int * n);
int main()
{
int n[1] = {3};
foo( n );
printf("%d", n[0]);
}
void foo(int * k)
{
k[0] = k[0] * k[0];
}
Answer:
Question 18
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program?
#include <stdio.h>
void foo(int * n);
int main()
{
int n = 3;
foo(&n);
printf("%d", n);
}
void foo(int * k)
{
*k = *k * *k;
}
Answer:
Question 19
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program?
#include <stdio.h>
void sum3(int *);
int main()
{
int array[] = {1, 2, 3};
sum3(array);
printf("%d", array[0]);
}
void sum3(int * nums)
{
nums[0] = nums[0] + nums[1] + nums[2];
}
Answer:
Question 20
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program?
#include <stdio.h>
void sum3(int a, int b, int c);
int main()
{
int array[] = {1, 2, 3};
sum3(array[0], array[1], array[2]);
printf("%d", array[0]);
}
void sum3(int a, int b, int c)
{
a = a + b + c;
}
Answer:
Question 21
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program?
#include <stdio.h>
int n = 1;
int main()
{
n++;
{
int n = 4;
}
printf("%d", n);
}
Answer:
Question 22
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program? (Answer is two
numbers with a space between them.)
#include <stdio.h>
int n = 1;
void foo(int k);
int main()
{
n++;
{
int n = 4;
foo( n );
printf("%d ", n);
}
printf("%d", n);
}
void foo(int k)
{
n = n + k;
}
Answer:
Question 23
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program? (Answer is two
numbers with a space between them.)
#include <stdio.h>
int n = 1;
void foo(int k);
int main()
{
n++;
{
int n = 4;
foo( n );
printf("%d ", n);
}
printf("%d", n);
}
void foo(int n)
{
n = 2 * n;
}
Answer:
Question 24
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program? (Answer is three
numbers with spaces between them.)
#include <stdio.h>
int n = 1;
void foo(int k);
int main()
{
n++;
{
printf("%d ", n);
int n = 4;
foo( n );
printf("%d ", n);
}
printf("%d", n);
}
void foo(int k)
{
n = 2 * k;
}
Answer:
Question 25
Not yet answered
Points out of 1.00
Flag question
Question text
In this problem, the main and the foo function are in different
files. What is the output?
/* main.c */
#include <stdio.h>
int n = 1;
void foo(int k);
int main()
{
foo(3);
printf("%d", n);
}
/* foo.c */
extern int n;
void foo(int k)
{
n = n + k;
}
Answer:
Question 26
Not yet answered
Points out of 1.00
Flag question
Question text
In this problem, the main and the foo function are in different
files. What is the output?
/* main.c */
#include <stdio.h>
static int n = 1;
void foo(int k);
int main()
{
foo(3);
printf("%d", n);
}
/* foo.c */
int n = 3;
void foo(int k)
{
n = n + k;
}
Answer:
Question 27
Not yet answered
Points out of 1.00
Flag question
Question text
In this problem, the main and the foo function are in different
files. What is the output?
/* main.c */
#include <stdio.h>
static int n = 1;
void foo(int *k);
int main()
{
foo(&n);
printf("%d", n);
}
/* foo.c */
static int n = 3;
void foo(int *k)
{
*k = *k << 2;
}
Answer:
Question 28
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program? The output is three
numbers separated by spaces.
#include <stdio.h>
void foo(int k);
int main()
{
int n = 1;
{
printf("%d ", n);
int n = 4;
foo( n );
printf("%d ", n);
}
printf("%d", n);
}
int n = 2;
void foo(int k)
{
n = 2 * k;
}
Answer:
Question 29
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program? (Answer is two
numbers with a comma between then.)
#include <stdio.h>
int foo(int n);
int main()
{
int n1, n2;
n1 = foo(3);
n2 = foo(3);
printf("%d,%d", n1, n2);
}
int foo(int k)
{
int n = 3;
n = n + 1;
return n + k;
}
Answer:
Question 30
Not yet answered
Points out of 1.00
Flag question
Question text
What is the output of the following program? (Answer is two
numbers with a comma between them.)
#include <stdio.h>
int foo(int n);
int main()
{
int n1, n2;
n1 = foo(3);
n2 = foo(3);
printf("%d,%d", n1, n2);
}
int foo(int k)
{
static int n = 3;
n = n + 1;
return n + k;
}
Answer:
Question 31
Not yet answered
Not graded
Flag question
Question text
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
I need help on this Systems review please! it's due by midnight monday. Question 1 Not...
Question 1 Consider the following program fragment that defines a self-referential class: #include <stdlib.h> #include <stdio.h> struct node_int; typedef struct node int *node; struct node_int void *data; node next; typedef struct list_int (node first;} *list; void main(int argc, char *argv[]) list shopping, t; node n; int x=25; shopping=(list) malloc(sizeof(struct list_int)); n= (node) malloc(sizeof(struct node_int)); n->data=shopping; n->next=NULL; shopping->first=n; t=(list) (shopping->first->data); // ***** t->first=NULL; // ***** n->data=&x; printf("%d\n", *((int *) (shopping->first->data))); a What will be displayed on the screen if the above...
Using C, I need help debugging this program. I have a few error messages that I'm not sure how to fix. Here is the code I have: /* * C Program to Print a Linked List in Reverse Order */ #include <stdio.h> #include <stdlib.h> struct node { int num; struct node *next; }; int main() { struct node *p = NULL; struct node_occur *head = NULL; int n; printf("Enter data into the list\n"); create(&p); printf("Displaying the nodes in the list:\n");...
Deleting multiples of a given integer from a linked list: #include <stdio.h> #include <stdlib.h> #include <assert.h> #define MAX 10000 typedef struct node_tag { int v; // data struct node_tag * next; // A pointer to this type of struct } node; // Define a type. Easier to use. node * create_node(int v) { node * p = malloc(sizeof(node)); // Allocate memory assert(p != NULL); // you can be nicer // Set the value in the node. p->v = v; p->next...
I JUST NEED HELP WITH DISPLAY PART! please help! thanks in advance // This function saves the array of structures to file. It is already implemented for you. // You should understand how this code works so that you know how to use it for future assignments. void save(char* fileName) { FILE* file; int i; file = fopen(fileName, "wb"); fwrite(&count, sizeof(count), 1, file); for (i = 0; i < count; i++) { fwrite(list[i].name, sizeof(list[i].name), 1, file); fwrite(list[i].class_standing, sizeof(list[i].class_standing), 1, file);...
Question 1 Not yet answered Marked out of 1.00 Flag question Question text Which of the following keywords is useful for skipping to the next iteration of a loop? Select one: a. do b. break c. switch d. continue e. while Clear my choice Question 2 Not yet answered Marked out of 1.00 Flag question Question text Consider the following line of Java code. System.out.println("Hello, World!"); "out" is which of the following? Select one: a. a statement b. a class...
Programming in C: I am trying to modify this linked list to be doubly linked list. I’m also trying to add a print in reverse function. I’m really struggling with how to change the insert function to doubly link the nodes without effecting the alphabetical sorting mechanism. Example of desired output: Enter your choice: 1 to insert an element into the list. 2 to delete an element from the list. 3 to end. ? 1 Enter a character: a The...
need this updated so it will delete the list and then recreate it again /***********************************************************/ /* Header files. */ /***********************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> /***********************************************************/ /* Structure definitions. */ /***********************************************************/ struct node { int data; struct node *right; struct node *left; }; struct trash { struct node *node; struct trash *next; }; /****************************************/ /* BUILD_LIST. */ /****************************************/ void BUILD_LIST(int number2Add, struct node *(*head), struct node *(*tail)) { int i; struct node *previous, *current; *head = NULL; *tail =...
^^^ Q3. I am trying to implement double linked list but I was failed to write the code so anyone gives the main Code in the main function THANK YOU FOR ADVANCE #include<stdio.h> #include<stdlib.h> #include<alloc.h> struct node { int info; struct node *lptr,*rptr; }; typedef struct node DL; DL *delete( ) , *insert ( ); void display(); DL *delete(DL *start,int x) { DL *left,*right,*curr; curr = start; if( start == NULL) { printf("\nDoubly...
I need to make it so this program outputs to an output.txt, the program works fine, just need it to fprintf to output.txt #include <stdio.h> #include <string.h> #include <malloc.h> #define MAX 30 struct treeNode { char names[MAX]; struct treeNode *right; struct treeNode *left; }*node; void searchName(char names[], struct treeNode ** parent, struct treeNode ** location) { struct treeNode * ptr, * tempPtr; if(node == NULL) { *location = NULL; *parent = NULL; return; } if(strcmp(names, node->names) == 0)...
Can someone provide codes in C for the following questions: Write C programs grah.h and graph.c to implement adjacent list graph representation and operation functions. Test with q1.c. graph.h #ifndef GRAPH_H #define GRAPH_H #include <stdio.h> #include <stdlib.h> #define INFINITY 99999 typedef struct adjnode { int vertex; int weight; struct adjnode *next; } ADJNODE; typedef struct graph { int order; //number of nodes int size; //number of edges ADJNODE **adjlist; //pointer to an array of pointers of neighbors } GRAPH; /*...