blog/assets/js/1acf65cc.6362c419.js

1 line
15 KiB
JavaScript
Raw Permalink Normal View History

"use strict";(self.webpackChunkfi=self.webpackChunkfi||[]).push([[8529],{34568:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>r,metadata:()=>o,toc:()=>c});var i=s(85893),t=s(11151);const r={slug:"garbage_collect",title:"Practice exam B",description:"Garbage everywhere\u2026\n",last_update:{date:new Date("2023-05-08T00:00:00.000Z")}},a="Garbage Collection",o={id:"pexam/b-garbage_collect",title:"Practice exam B",description:"Garbage everywhere\u2026\n",source:"@site/c/pexam/b-garbage_collect.md",sourceDirName:"pexam",slug:"/pexam/garbage_collect",permalink:"/c/pexam/garbage_collect",draft:!1,unlisted:!1,editUrl:"https://github.com/mfocko/blog/tree/main/c/pexam/b-garbage_collect.md",tags:[],version:"current",lastUpdatedAt:1683504e3,formattedLastUpdatedAt:"May 8, 2023",frontMatter:{slug:"garbage_collect",title:"Practice exam B",description:"Garbage everywhere\u2026\n",last_update:{date:"2023-05-08T00:00:00.000Z"}},sidebar:"autogeneratedBar",previous:{title:"Practice Exams",permalink:"/c/category/practice-exams"},next:{title:"Practice exam C",permalink:"/c/pexam/cams"}},l={},c=[{value:"Format of the shell history",id:"format-of-the-shell-history",level:2},{value:"Format of the output",id:"format-of-the-output",level:2},{value:"<code>-gt \u2039min_size\u203a</code>",id:"-gt-min_size",level:3},{value:"<code>-f \u2039total_size\u203a \u2039min_unused\u203a</code>",id:"-f-total_size-min_unused",level:3},{value:"Example usage",id:"example-usage",level:2},{value:"Requirements and notes",id:"requirements-and-notes",level:2}];function d(e){const n={a:"a",admonition:"admonition",annotation:"annotation",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",li:"li",math:"math",mi:"mi",mo:"mo",mrow:"mrow",ol:"ol",p:"p",pre:"pre",section:"section",semantics:"semantics",span:"span",strong:"strong",sup:"sup",ul:"ul",...(0,t.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{id:"garbage-collection",children:"Garbage Collection"}),"\n",(0,i.jsx)(n.admonition,{title:"Exam environment",type:"warning",children:(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["During the exam you will be provided with a barebone ",(0,i.jsx)(n.em,{children:"exam session"})," on the\n",(0,i.jsx)(n.em,{children:"faculty computers"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["In browser you are only allowed to have the following tabs open:","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://en.cppreference.com",children:"C documentation"})}),"\n",(0,i.jsx)(n.li,{children:"page containing the assignment"}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["You ",(0,i.jsx)(n.strong,{children:"are not"})," allowed to use your own source code, e.g. prepared beforehand\nor from the seminars."]}),"\n",(0,i.jsxs)(n.li,{children:["You have ",(0,i.jsx)(n.strong,{children:"5 minutes"})," to read through the assignment and ask any follow-up\nquestions should be there something unclear."]}),"\n",(0,i.jsxs)(n.li,{children:["You have ",(0,i.jsx)(n.strong,{children:"60 minutes"})," to work on the assignment, afterward your work will be\ndiscussed with your seminar tutor."]}),"\n"]})}),"\n",(0,i.jsxs)(n.p,{children:["You have gotten into a trouble during your regular upgrade of your archLinux",(0,i.jsx)(n.sup,{children:(0,i.jsx)(n.a,{href:"#user-content-fn-1",id:"user-content-fnref-1","data-footnote-ref":!0,"aria-describedby":"footnote-label",children:"1"})}),"\ninstallation\u2026 You've been carelessly running the upgrades for months and forgot\nabout clearing up the caches."]}),"\n",(0,i.jsxs)(n.p,{children:["Your task is to write a program ",(0,i.jsx)(n.code,{children:"garbage_collect"})," that will evaluate the shell\nhistory provided as a file and will try to find files or directories that are\nsuspiciously big and decide which of them should be deleted to free some space."]}),"\n",(0,i.jsx)(n.h2,{id:"format-of-the-shell-history",children:"Format of the shell history"}),"\n",(0,i.jsx)(n.p,{children:"You are provided one file consisting of the captured buffer of the terminal. You