Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Final Exam Practice for cs351, Exercises of Embedded Systems Programming

Subject : CS351 , Final exam practice.

Typology: Exercises

2024/2025

Uploaded on 05/08/2025

mouaad-1
mouaad-1 🇺🇸

1 document

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 351 Final Exam Practice Questions (answers on last page)
MCQ 1:
struct Score{
int x, y;
};
struct Score points[100];
int sum = 0;
for (int i = 0; i < 100; i++){
sum += points[i].x + points[i].y;
}
The code in the above loop is an example of:
A) Good temporal locality
B) Good spatial locality
C) Both good spatial and good temporal locality
D) None of the above
MCQ 2:
int arr[50];
char *ap=(char *)arr;
Which of the following accesses the same value as arr[20]?
A) *((int*)(ap+20*sizeof(int)))
B) *((char *)(ap+20))
C) *((int *)(ap+20))
D) *((char *)(ap+20*sizeof(int)))
pf3

Partial preview of the text

Download Final Exam Practice for cs351 and more Exercises Embedded Systems Programming in PDF only on Docsity!

CS 351 Final Exam Practice Questions (answers on last page)

MCQ 1:

struct Score{ int x, y; }; struct Score points[100]; int sum = 0; for (int i = 0; i < 100; i++){ sum += points[i].x + points[i].y; } The code in the above loop is an example of: A) Good temporal locality B) Good spatial locality C) Both good spatial and good temporal locality D) None of the above MCQ 2: int arr[50]; char *ap=(char )arr; Which of the following accesses the same value as arr[20]? A) ((int)(ap+20sizeof(int))) B) *((char *)(ap+20)) C) *((int *)(ap+20)) D) *((char )(ap+20sizeof(int)))

True or False: In an implicit free list allocator, each free block contains pointers to the next and previous free blocks. Inserting freed blocks so that free list blocks are always in address order requires linear time. Internal fragmentation occurs when free memory is divided into small, noncontiguous chunks, preventing the allocation of large blocks despite there being enough total free space. In an explicit free list, boundary tags are typically not needed for coalescing.