logo

Crowdly

Browser

Додати до Chrome

ECE2071 - Systems programming - S1 2025

Шукаєте відповіді та рішення тестів для ECE2071 - Systems programming - S1 2025? Перегляньте нашу велику колекцію перевірених відповідей для ECE2071 - Systems programming - S1 2025 в learning.monash.edu.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

Given the following struct definitions of a linked-list based queue:

 

struct QueueNode

{

struct QueueNode

*next;

unsigned int

value;

};

struct Queue

{

struct QueueNode

*front;

struct QueueNode

*rear;

};

// <![CDATA[

hljs.highlightAll();

// ]]>

 

Task 1: Write an insert function to insert an item at the end of the queue. The function prototype has been provided for you below.

void insert(struct Queue* queue, unsigned int value);

 

Task 2: Write a serve function to serve (remove) an item (from the front) of the queue. The function prototype has been provided for you below.

int serve(struct Queue* queue);

 

Task 3: In the main function, write code that does the following:

  • Reads in a single string of letters and numbers (you can assume that the only letter will be an 's' character)
  • For each single

    character in the string:

    • If it is a numerical character, convert that character to an integer and insert it into the queue
    • If it is an 's', serve the next item in the queue and print that integer to the console, followed by a single space character

 

 

Notes:

  • You may also use whatever editor/test environment you like to write your solution.
  • Your code MUST be submitted as a .txt file below BEFORE the end of the test
  • Your code will be run against test cases and manually reviewed
  • You may wish to define additional functions as needed
  • You should use good programming practices

Your code MUST be submitted as a .txt file BEFORE the end of the test (copy and paste into a .txt file).

Переглянути це питання

Suppose we have the following program, running on a 64-bit computer:

#include<stdio.h>

#include<string.h>

typedef struct {

int id;

char name[52];

float salary;

} Employee;

void printEmployee(Employee e) {

printf("ID: %d\n", e.id);

printf("Name: %s\n", e.name);

printf("Salary: %.2f\n", e.salary);

}

int main() {

Employee e1;

int e1ID = 1;

e1.id = e1ID;

strcpy(e1.name, "John Doe");

float e1Sal = 50000.00;

e1.salary = 50000.00;

printEmployee(e1);

Employee* e1Ptr = &e1;

return 0;

}

 

Select the correct statement about the size of variables in the main function from the options below:

0%
0%
0%
0%
Переглянути це питання

Select the false statements from the selection below:

0%
0%
0%
100%
0%
0%
Переглянути це питання

Consider the following C program, which writes a sequence of numbers to a file named “output.txt”. In the answer box below, carefully write the exact contents of “output.txt” after executing the program.

#include <stdio.h>

int main() {

FILE *file = fopen("output.txt", "w");

if (file != NULL) {

for (int i = 1; i/2 <= 2; i++) {

fprintf(file, "%d,", i);

}

fclose(file);

}

return 0;

}

Переглянути це питання

Which of the following are valid methods to check if the end of the file has been reached in C?

Переглянути це питання

Which of the following options are not valid modes to open a file with in C? Assume that the file will be opened using the following:

FILE *myFile = fopen("filename.txt", mode);

0%
0%
0%
0%
0%
Переглянути це питання

While you are still in the src directory, type the command that will open myFolder in VS code. You should not change the current working directory, and you should not use the full raw path.

Note: we wish to open the myFolder directory in VS code, not the src folder, so think carefully!

Переглянути це питання

Now that you are in the src directory, type the command that will display the content of the program2.c source code.

Переглянути це питання

Suppose you have a terminal that is currently in the home directory. In the box below, type the command that will navigate to the src folder that lies within the myFolder directory.

Переглянути це питання

Which of the following root-finding methods repeatedly splits the search interval into two even parts?

Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на learning.monash.edu?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome