midterm2-sol - CS 211 Midterm 2 100 points Instructor Prof Santosh Nagarakatte Full Name Here RUID Question 1 2 3 4 5 Max Points 20 20 25 20 15 1 Points

midterm2-sol - CS 211 Midterm 2 100 points Instructor Prof...

  • Rutgers University
  • CS 211
  • Test Prep
  • HimadriB
  • 13
  • 100% (20) 20 out of 20 people found this document helpful

This preview shows page 1 - 5 out of 13 pages.

CS 211: Midterm 2: 100 pointsInstructor: Prof. Santosh NagarakatteFull Name Here:RUID:QuestionMax PointsPoints1202203254205151
Background image
Problem 1: (10+10 points)Answer “True” or “False” to these questions. If the answer is “False”, you need to provide a reason to statewhy the answer is “False” (you will not get points otherwise).1. The C switch instruction is converted to a series of jumps in all cases. True or False?2.A.B+Bis the minimal boolean expression that cannot be simplified to a simpler circuit. True orFalse?3. A single D-latch can store 1-bit of information even though it has two outputs. True or False?4. 1111 is the largest negative number in signed 4-bit one’s complement representation. True or False?5. If register %eaxholds a pointer to an integer, then executing the cmdp/x$eaxin gdb prints out theaddress of the integer. True or False?2
Background image
C Programming (10 points)1. (10 points) Write a C program to reverse a singly linked list? If you write Java code (instead of C),you will not get any points.Use the prototype below:struct node{int field;struct node* link;};// complete this function, list points to the head of the linked liststruct node* reverse(struct node* list){// Fill your code herestruct node* reversed_list = NULL;struct node* temp;while(list != NULL){temp = list->next;list->next = reversed_list;reversed_list = list;list = temp;}return reversed_list;}3
Background image
Problem 2: Assembly Programming 1 (20 Points)1. (15 points) Write the equivalent C code for the following assembly snippet.Hint: all functions inthis code take one integer input argument and output one integer result. Show your work next to
Background image
Image of page 5

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture