








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Purdue CS 252 Systems Programming Midterm Exams 2025-2026 Guide
Typology: Exams
1 / 14
This page cannot be seen from the preview
Don't miss anything!
Purdue CS 252 Systems Programming Midterm Exams 2025-2026 Guide
What are the difforent types of memory scclions? - ANSWEF-Tcxt Data BSS Heap Stack What is stored in texl?- ANSWEF-Instructions that run the program. What is stored in Data?- ANSWEF-Initialized global variables What is stored in BSS? - ANSWEFUninitialized global variables (initialized to 0 by default) What is stored in the heap?- ANSWER-Memory that was returned by malloc/new. It grows as you requesl more. [grows upwards] What is stored in the stack? - ANSWEFR-Local variables and return addresses. [grows downward] What are dynamic libraries? - ANSWER-They are libraries shared with ather processes. Each have their own text, data, bss. What is a program? - ANSWER-File in a special format that contains all necessary information to load and application and make it run. What are some examples of executable file formats? - ANS WERELF - Executable Link File (Linux) COFF - Common Object File Format (Windows) What are the different steps to build a program? - ANSWER-Editor, C preprocessor, Compiler, Optimizer, Assembler, Linker, Loader What does the preprocessor do? - ANSWER-Expands macros like #define and #include to generate a .i file. What does the compiler do? - ANSWER-Compiles the .i file, which generates assembly code into a.s file What does the assembler do? - ANSWER-Assembles the .s file into an object file .o What does the linker do? - ANSWE-Connect known libraries to the object file. Sets most of the addresses for objects and files. Won’l know aboul. shared objcets, so will be UNDEF. What does the loader (runtime linker) do? - ANSWEF-It takes the executable file, and allocated memory for the sections. Also fills in UNDEF sections. WII finally jump into entry point. What is the entry point of a program? - ANSWER start which will initialize values then jump into main. When main is done, it will call _exit. Why u: left and right objects are free in OC) time. boundary tags?- ANSWER-Allow for constant time coalescing since you can see if the What are the different types of memory allocation errors? - ANSWER-Memory Leaks, Premature Frees, Double Free, Wild Frees, Memory Smashing What causes memory leaks? - ANSWER-Leaks are objects in memory that are no longer being used but are not freed. Worse for 24/7 programs where they can accumulate quickly. Object * ob] = new Obj0; obj =new Ohbjecti // old object is leaked What causes premature frees? - ANSWER-Premature frees are caused when an object that is still in use by the program is freed. Can override the next/previous pointers in the free list, thus corrupling it. ?- ANSWER-Alver frecing an ahje 8 equal to NULL. Then, next time you try and modify the object you will crash at that line rather of premature fre How can we minimize the impe than later down the road. What causes a double free?- ANSWER-A double free is caused by fi already free. The object is added to the free list twice, thus corrupting it. ing an object that is What causes a wild free? - ANSWEF-Wild frees happen when a program attempts to free a pointer not returned by malloc. What is memory smashing? - ANS WERMemory smashing happens when less memory is allocated than the memory that will be used. Will overwrite header of next block, which can cause a crash. What is an operating system? - ANSWER-An OS is a program that sits in between the hardware and the user program. What kind of file system does UNIX have? - ANSWER Hierarchical file system What are some important directories? - ANSWER-/ - Root Directory /ete - OS Config files (passwd, groups) /dev - List of devices attached Aasr - Libraries and tools What is a dcamon? - ANSWER-Programs running in the background implementing a service (server). What is root? - ANSWER-User with special privileges to modify files anywhere in the system. What are the yellow pages? - ANSWER-In some systems, password and group files are stored in a server that makes management casicr. How are partitions divided? - ANSWER-Bool Block, Suporblock, Inede-list, Data Block What is in the boot block? - ANSWER-Block wilh small picce of code that tells the parution Lhe OS is going to start. Assume 1 Kb block and 256 block numbers in each index block. - ANSWER-Direct= 12 * 1Kb = 12Kb Single=3 * 255 * 1Kb = 768 Kb Double=1 * 256 * 256 * 1Kb = 64Mb Triple=1* 256 * 256 * 256 * 1Kb = 16Gb How is a directory represented? - ANSWER-File that contains list of pairs, (file name, Inode number). What is a hard link? - ANSWER-Connection between file name and Inode number). If file is renamed, link will stay. What is a soft link? - ANSWER-Pair: (file name, inode number-with-file-storing-path). Like shortcuts, can point to files in different partitions. No reference count, no increment/decrement. Tf file is renamed, link will break When does UNIX time start? - ANSWER-0:00 Jan 1, 1970 How are the permission bits separated in UNIX? - ANSWEICuser group other CWwX PWX WX How do you change the permission bits? - ANSWER-chmod