logo

Crowdly

ECE2071 - Systems programming - S1 2025

Looking for ECE2071 - Systems programming - S1 2025 test answers and solutions? Browse our comprehensive collection of verified answers for ECE2071 - Systems programming - S1 2025 at learning.monash.edu.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Using the following data (if b prefix, assume binary, otherwise, decimal. I.e. $t0=5 means 101 is stored in the bottom bits of $t0, $t0=b101 means the same thing)

    $t1 = b1110

    $t2 = 15

    $t3 = 12

    $t4 = 9

    $t5 = b1010

    $zero

What is in register $v0 after the execution of each of the following instructions: (answer in decimal, not hexademical or binary)

  1. and $v0, $t1, $zero:
  2. ori $v0, $t5, 15:
  3. xor $v0, $t3, $t3:
  4. and $v0, $t4, $t3:

 

 

View this question

What single instruction could you use to create the 4-bit one’s complement (inverted) version of the value in register $t1 and store it in $v0?

WARNING: cannot be pseudo - ie “P” type instruction, as these are not “one instruction”.

You should enter your answer as a single instruction in the format:

  • For R-type instructions:

    • <instruction_name> <register>, <register>, <register> 

  • For I-type instructions:

    • <instruction_name> <register>, <register>, <immediate>

  • For J-type instructions:

    • <instruction_name> <label>

For example, if your answer was to use the add instruction with $t0, $t1, and $t2, you would enter the text:

add $t0, $t1, $t2

 

View this question

For the table you filled out above, do you notice any patterns?

 

View this question

Suppose we have a single bit, either 1 or 0. We will now consider what might happen if we perform any one of the following operations on this number:

  1. AND with 0
  2. OR with 0
  3. XOR with 0
  4. AND with 1
  5. OR with 1
  6. XOR with 1

What is the final value? Fill out the table below, using 0 for false, and 1 for true.

 

 01
AND with 0
OR with 0
XOR with 0
AND with 1
OR with 1
XOR with 1

 

 
View this question

Select all of the lines that contains errors in the provided code.

0%
100%
0%
100%
100%
0%
0%
0%
0%
0%
0%
100%
0%
View this question

Select all of the instructions from the program above that are pseudoinstructions. (If none are psuedoinstructions, select the "none of the other options" option)

0%
100%
0%
0%
0%
View this question

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).

View this question

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%
View this question

Select the false statements from the selection below:

100%
0%
0%
0%
0%
0%
View this question

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;

}

View this question

Want instant access to all verified answers on learning.monash.edu?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!