├── robots.txt ├── img ├── 25.png ├── 26.png ├── 27.png ├── 35.png ├── 36.png ├── 37.png ├── 38.png ├── 39.png ├── 40.png ├── 56.png ├── 57.png ├── 58.png ├── 59.png ├── 60.png ├── 61.png ├── 62.png ├── 63.png └── FDS │ ├── accuracy80.png │ ├── 1positive0negative.png │ └── matrixwhatcanwesay.png ├── .github └── ISSUE_TEMPLATE │ └── domanda-o-risposta-sbagliata.md ├── css └── styles.css ├── js ├── config.js └── main.js ├── README.md ├── index.html ├── json ├── swInedite.json ├── so2_2025_mz.json ├── cc.json └── 2022_FDS.json └── LICENSE /robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: / 3 | -------------------------------------------------------------------------------- /img/25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/25.png -------------------------------------------------------------------------------- /img/26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/26.png -------------------------------------------------------------------------------- /img/27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/27.png -------------------------------------------------------------------------------- /img/35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/35.png -------------------------------------------------------------------------------- /img/36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/36.png -------------------------------------------------------------------------------- /img/37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/37.png -------------------------------------------------------------------------------- /img/38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/38.png -------------------------------------------------------------------------------- /img/39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/39.png -------------------------------------------------------------------------------- /img/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/40.png -------------------------------------------------------------------------------- /img/56.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/56.png -------------------------------------------------------------------------------- /img/57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/57.png -------------------------------------------------------------------------------- /img/58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/58.png -------------------------------------------------------------------------------- /img/59.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/59.png -------------------------------------------------------------------------------- /img/60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/60.png -------------------------------------------------------------------------------- /img/61.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/61.png -------------------------------------------------------------------------------- /img/62.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/62.png -------------------------------------------------------------------------------- /img/63.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/63.png -------------------------------------------------------------------------------- /img/FDS/accuracy80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/FDS/accuracy80.png -------------------------------------------------------------------------------- /img/FDS/1positive0negative.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/FDS/1positive0negative.png -------------------------------------------------------------------------------- /img/FDS/matrixwhatcanwesay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dag7dev/UniQuizzes/HEAD/img/FDS/matrixwhatcanwesay.png -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/domanda-o-risposta-sbagliata.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Domanda o risposta sbagliata 3 | about: C'è un refuso in una domanda o una risposta? Fallo presente. 4 | title: "[ANS] Domanda/Risposta sbagliata " 5 | labels: help wanted 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Argomento**: 11 | <(es. SO2, FDS...)> 12 | 13 | **Domanda**: 14 | 15 | 16 | **Domanda da correggere**: 17 | - la vecchia domanda è: 18 | - invece dovrebbe essere: 19 | 20 | **Risposta da correggere**: 21 | - la vecchia risposta è: 22 | - invece dovrebbe essere: 23 | -------------------------------------------------------------------------------- /css/styles.css: -------------------------------------------------------------------------------- 1 | @media screen and (max-width: 767px) { 2 | .btn { 3 | margin-bottom: 10px; 4 | } 5 | } 6 | 7 | body { 8 | font-family: 'Arial', sans-serif; 9 | line-height: 1.6; 10 | background-color: #f7f7f7; 11 | } 12 | 13 | .container { 14 | max-width: 800px; 15 | padding-bottom: 40px; 16 | } 17 | 18 | h3 { 19 | margin-top: 20px; 20 | } 21 | 22 | hr { 23 | border: 1px solid #ddd; 24 | } 25 | 26 | a { 27 | color: #0066cc; 28 | text-decoration: none; 29 | } 30 | 31 | a:hover { 32 | text-decoration: underline; 33 | } 34 | 35 | 36 | 37 | .btn-close { 38 | background-color: transparent; 39 | border: none; 40 | } 41 | 42 | .btn-close:hover { 43 | background-color: transparent; 44 | } 45 | 46 | #btn-quiz-reload { 47 | margin-top: 10px; 48 | } 49 | 50 | .answer-code { 51 | border: 1px solid rgba(127, 127, 127, 0.7); 52 | white-space: break-spaces; 53 | } 54 | 55 | .answer-label { 56 | width: 100%; 57 | } 58 | -------------------------------------------------------------------------------- /js/config.js: -------------------------------------------------------------------------------- 1 | //////////// 2 | // CONFIG // 3 | //////////// 4 | var nMinutes = 25; // 25, suggested 5 | var correctAnswerPoints = 2 6 | var wrongAnswerPoints = 1 7 | var noAnswerPoints = 0 8 | var numberOfQuestions = 40 // default number of questions that you want to show 9 | var title = "UniQuizzes" 10 | var disclaimerText = "The simulator is not updated automatically. Have a look at the source on Github, and if necessary propose new changes!" 11 | var infoText = "If you like this project, consider starring the repo on Github!" 12 | 13 | // CUSTOMIZABLE PART OF THE PAGE - SHOWS OR HIDES SOME PARTS 14 | // if a part is disabled, then the related functionality will be disabled 15 | var showSlider = true 16 | var showTimer = true 17 | var showShuffleQuestions = true 18 | var showShuffleAnswers = true 19 | 20 | // additional URL and description shown in header 21 | var customLink = "https://github.com/dag7dev/UniQuizzes" 22 | var customDescription = "Give a star on Github" 23 | 24 | // FILES 25 | var jsonFolder = "json" // json folder where to load your json files 26 | var jsonFiles = { // load other quizzes 27 | "so12024.json": "SO1 2024", 28 | "so1.json": "SO1", 29 | "so2.json": "SO2", 30 | "so2_2025_mz.json": "SO2 2025 (MZ)", 31 | "swInedite.json": "SW - Inedite", 32 | "OLD_so1.json": "Archivio SO1", 33 | "2022_FDS.json": "FDS 2022", 34 | "so2mz.json": "SO2 2023", 35 | "cc.json": "Cloud Computing" 36 | }; 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UniQuizzes 2 | | Homepage | Domande | 3 | | ---- | ---- | 4 | | ![image](https://github.com/dag7dev/UniQuizzes/assets/44711271/8db55bbd-3a28-459f-a0af-c74e8294924a) | ![image](https://github.com/dag7dev/UniQuizzes/assets/44711271/b7ab4ad4-1358-4c48-bb46-8b2e63b97338) | 5 | 6 | 7 | 8 | Repository che contiene tanti test, che trattano Sistemi Operativi (entrambi), Ingegneria del Software e molto altro. 9 | 10 | Semplice app **ora anche da web** che si occuperà di addestrare il cadetto all'esame di SO1, SO2 e tante altre materie. 11 | 12 | Cerchi un'altra versione? [Clicca qui](https://github.com/dag7dev/UniQuizzes?tab=readme-ov-file#altre-versioni) 13 | 14 | ## Disclaimer 15 | > Ci solleviamo da ogni responsabilità di utilizzo improprio di questo strumento, e non garantiamo in alcun modo che le risposte siano corrette o errate. 16 | 17 | Utilizzalo a tuo rischio e pericolo ma cosa più importante: dai una mano ai tuoi colleghi aggiungendo o modificando domande, **basta una PR o una issue!** 18 | 19 | ## Informazioni generali 20 | Il punteggio è calcolato nel seguente modo: +2 punti per ogni risposta corretta, -1 punto per ogni risposta errata, 0 per ogni risposta saltata 21 | 22 | La versione web è stata scritta in un orribile **JavaScript** in fretta e furia e si basa su [JSQuizee](https://github.com/dag7dev/JSQuizee/), un motore di quiz offline. 23 | 24 | Solitamente il codice javascript viene aggiornato grazie a quest'ultima repo: non è sempre così, ma se vuoi contribuire ed aggiungere funzionalità, consiglio di aggiornare direttamente l'engine! 25 | 26 | ### Info sul JSON 27 | `code`: se contiene del testo, verrà mostrato in forma di codice sorgente subito dopo il testo della domanda 28 | 29 | `answers_have_code`: se a "1", le domande verranno renderizzate come codice in un box. 30 | 31 | **ATTENZIONE**: il codice deve essere propriamente escapizzato, e ogni nuova riga deve avere `\n` alla fine 32 | 33 | ## Istruzioni per l'offline 34 | ### Requisiti 35 | 1. Un qualunque web server (si consiglia `python -m http.server` per semplicità) 36 | 2. Un browser 37 | 3. Git 38 | 39 | ### Istruzioni 40 | 1. clonare questa cartella 41 | 42 | 2. andare nella cartella di UniQuizzes e digitare: 43 | ``` 44 | python -m http.server 45 | ``` 46 | 47 | Potrai eseguirlo in locale digitando `http://0.0.0.0:8000/` sul tuo browser. 48 | 49 | ## Come contribuire 50 | - **inserendo nuovi quiz**: 51 | - vai nella cartella `json` e crea un file in `.json`. Usa come modello i JSON già esistenti 52 | - vai nel file `config.js` nella cartella `js` e aggiungi il tuo file nella lista dei file 53 | - **revisionando i quiz esistenti**: 54 | - vai nella cartella `json` e modifica il file che vuoi correggere 55 | - in alternativa, apri una issue dove specifichi: `file, risposta attuale, risposta corretta, motivo` 56 | - **implementando nuove funzionalità su JSQuizee**: l'engine sul quale si basa UniQuizzes è [JSQuizee](https://github.com/dag7dev/JSQuizee/), un engine di quiz offline. Se verranno implementate modifiche su JSQuizee, UniQuizzes verrà aggiornato all'ultima versione di JSQuizee. 57 | 58 | Se il progetto ti è stato utile, o se hai passato esami, non dimenticare di lasciare una stella :D 59 | 60 | ## Troubleshooting sull'offline 61 | Q: L'app non legge i JSON tramite file locali. Normale? 62 | - Non l'hai avviata tramite server. È requisito fondamentale farlo, poiché normalmente i browser non possono accedere ai file locali. 63 | 64 | Q: L'app non legge i JSON nonostante il server tramite file locali. Che ho sbagliato? 65 | - Il JSON 66 | 67 | Q: Quando implementerai la pagina di creazione semplice dei JSON? 68 | - Non ho una deadline, e lavoro a questo progetto nel tempo libero. 69 | 70 | ## Funzionalità future 71 | - [X] GUI cross-platform 72 | - [X] Una GUI fatta come si deve _Implementata nel 2024_ 73 | - [X] Un json che **include quesiti SO1** 74 | - [X] Linee guida per contribuire 75 | - [ ] Editor json in-browser (aggiungere, modificare, rimuovere domande): potrebbe essere un'idea farlo in markdown 76 | - [ ] Analytics: attualmente non c'è un modo di sapere se state usando UniQuizzes. Avevo dato il progetto per morto, ma ho visto che è ancora usato. Se volete contribuire allo sviluppo, supportate il progetto con una stella e una PR. 77 | 78 | ## Altre versioni 79 | - Versione Java **(cross platform)** solo domande SO modulo 2 (NON AGGIORNATA E NON MANTENUTA)**: [so2-exam-sim](https://github.com/andrea-gasparini/SO2-exam-simulator) 80 | - Telegram: [so1bot](https://github.com/appinfosapienza/so-un-bot) 81 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSQuizee - JS Simple Quiz Engine 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |

23 | 24 |

25 | 26 |
27 |
28 | User Avatar 29 |
30 |
31 | 32 | 40 | 41 | 46 | 47 | 52 | 53 |

Rules

54 |

55 | 56 |

Settings

57 |
58 | 59 | 73 |
74 | 75 | 76 | 77 |

Graphics

78 | 79 | 80 |
81 | 82 | 83 |
84 | 85 |

Options

86 |
87 | 89 | 90 |
91 | 92 |
93 | 95 | 96 |
97 | 98 |
99 | 101 | 102 |
103 | 104 | 105 |
106 | 107 | 108 | 109 |
110 | 111 | 112 |
113 |

114 |

115 |
116 | 117 |
118 | 119 |
120 | 121 | 122 | 123 | 124 | 139 | 140 | 141 | 205 | 206 | 207 | 208 | -------------------------------------------------------------------------------- /json/swInedite.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "question": "Identificare uno svantaggio della modularizzazione", 4 | "answers": [ 5 | "nessuno di questi", 6 | "livello di astrazione desiderato può essere inserito nei programmi", 7 | "manutenzione più facile con componenti più piccole", 8 | "programmi divisi in base ad aspetti funzionali" 9 | ], 10 | "correct": "a", 11 | "answers_have_code": 0, 12 | "code": "" 13 | }, 14 | { 15 | "question": "Quale dei seguenti è un tipo di Modello Architetturale?", 16 | "answers": [ 17 | "Static structural model", 18 | "tutti quelli menzionati", 19 | "Distribution model", 20 | "Dynamic process model" 21 | ], 22 | "correct": "b", 23 | "answers_have_code": 0, 24 | "code": "" 25 | }, 26 | { 27 | "question": "Quale di queste view mostra che il sistema è composto da processi interagenti a run time", 28 | "answers": [ 29 | "physical", 30 | "development", 31 | "logical", 32 | "process" 33 | ], 34 | "correct": "d", 35 | "answers_have_code": 0, 36 | "code": "" 37 | }, 38 | { 39 | "question": "Quale/i dei seguenti è un conflitto Architetturale", 40 | "answers": [ 41 | "tutti quelli menzionati", 42 | "localizzare caratteristiche di safety in genere richiedo maggiori comunicazioni conridotta efficienza", 43 | "componenti a grana grossa migliorano l'efficienza e riducono la manutenibilità", 44 | "nessuna" 45 | ], 46 | "correct": "a", 47 | "answers_have_code": 0, 48 | "code": "" 49 | }, 50 | { 51 | "question": "Quale documento viene creato dal system analyst dopo che i requisiti sono stati raccolti dai vari stakeholders", 52 | "answers": [ 53 | "feasibility study", 54 | "software requirement validation", 55 | "requirement gathering", 56 | "software requirement specification" 57 | ], 58 | "correct": "d", 59 | "answers_have_code": 0, 60 | "code": "" 61 | }, 62 | { 63 | "question": "Coupling è una indicazione qualitativa del fatto che un modulo", 64 | "answers": [ 65 | "si focalizza su una cosa solamente", 66 | "è in grado di completare le sue funzioni tempestivamente", 67 | "può essere scritto in maniera più compatta", 68 | "è connesso ad altri moduli ed l mondo esterno" 69 | ], 70 | "correct": "d", 71 | "answers_have_code": 0, 72 | "code": "" 73 | }, 74 | { 75 | "question": "Il primo passo nel Software Development Life Cycle è", 76 | "answers": [ 77 | "analisi", 78 | "Identificazione del problema e delle opportunità", 79 | "progettazione", 80 | "sviluppo e documentazione" 81 | ], 82 | "correct": "b", 83 | "answers_have_code": 0, 84 | "code": "" 85 | }, 86 | { 87 | "question": "L'importanza del software design si può riassumere in una sola parola che è", 88 | "answers": [ 89 | "Qualità", 90 | "Complessità", 91 | "Precisione", 92 | "Efficienza" 93 | ], 94 | "correct": "a", 95 | "answers_have_code": 0, 96 | "code": "" 97 | }, 98 | { 99 | "question": "Quale dei seguenti non influenza la qualità del software ed il rendimento dell'organizzazione?", 100 | "answers": [ 101 | "prodotto", 102 | "mercato", 103 | "tecnologia", 104 | "persone" 105 | ], 106 | "correct": "b", 107 | "answers_have_code": 0, 108 | "code": "" 109 | }, 110 | { 111 | "question": "Cohesion (coesione) è una indicazione qualitativa del fatto che un modulo", 112 | "answers": [ 113 | "si focalizza su una cosa solamente", 114 | "può essere scritto in maniera più compatta", 115 | "è in grado di completare le sue funzioni tempestivamente", 116 | "è connesso ad altri moduli ed l mondo esterno" 117 | ], 118 | "correct": "a", 119 | "answers_have_code": 0, 120 | "code": "" 121 | }, 122 | { 123 | "question": "Quale tecnica è applicabile quando altri progetti nello stesso dominio di applicazione sono stati completati?", 124 | "answers": [ 125 | "Legge di Parkinson (Il lavoro si espande fino ad occupare tutto il tempo disponibile)", 126 | "giudizio di esperti", 127 | "modellazione algoritmica dei costi", 128 | "stima per analogia" 129 | ], 130 | "correct": "d", 131 | "answers_have_code": 0, 132 | "code": "" 133 | }, 134 | { 135 | "question": "Un ................ si sviluppa usando informazioni storiche sui costi che collegano netriche di software al costo del progetto", 136 | "answers": [ 137 | "stime per analogia", 138 | "modello algoritmico dei costi", 139 | "legga di Pakinson (Il lavoro si espande fino ad occupare tutto il tempo disponibile)", 140 | "giudizio di un esperto" 141 | ], 142 | "correct": "b", 143 | "answers_have_code": 0, 144 | "code": "" 145 | }, 146 | { 147 | "question": "Quale dei seguenti non si può ottenere con strumenti automatici di stima?", 148 | "answers": [ 149 | "predirre costi del software", 150 | "predirre le richieste del cliente", 151 | "predirre livelli di personale", 152 | "predirre la schedulazione del software" 153 | ], 154 | "correct": "b", 155 | "answers_have_code": 0, 156 | "code": "" 157 | }, 158 | { 159 | "question": "Quale delle seguenti affermazioni sul Model Checking è sbagliata ?", 160 | "answers": [ 161 | "non è computazionalmente oneroso", 162 | "esplora tutti i possibili percorsi nel modello", 163 | "tutte e tre le menzionate", 164 | "è particolarmente utile per verificare sistemi concorrenti" 165 | ], 166 | "correct": "a", 167 | "answers_have_code": 0, 168 | "code": "" 169 | }, 170 | { 171 | "question": "Quale modello assume che i sistemi siano creati da componenti riusabili, scripting a programmazione di basi di dati?", 172 | "answers": [ 173 | "post-architecture model", 174 | "application-composition model", 175 | "reuse model", 176 | "early design model" 177 | ], 178 | "correct": "b", 179 | "answers_have_code": 0, 180 | "code": "" 181 | }, 182 | { 183 | "question": "Quake dei seguenti non è una misura diretta di processo di IngSw?", 184 | "answers": [ 185 | "tutti i menzionati", 186 | "costo", 187 | "efficienza", 188 | "sforzo impiegato" 189 | ], 190 | "correct": "c", 191 | "answers_have_code": 0, 192 | "code": "" 193 | }, 194 | { 195 | "question": "Quale dei seguenti non è considerato un rischio in project management?", 196 | "answers": [ 197 | "testing", 198 | "ritardi nelle specifiche", 199 | "avvicendamento del personale", 200 | "prodotti in competizione" 201 | ], 202 | "correct": "a", 203 | "answers_have_code": 0, 204 | "code": "" 205 | }, 206 | { 207 | "question": "Quale/i di questi parametri principali dovresti usare per calcolare i costi di un progetto di sviluppo software?", 208 | "answers": [ 209 | "costi di hardware e software", 210 | "costi di viaggio ed addestramento", 211 | "remunerazioni di software engineers e managers", 212 | "tutti questi" 213 | ], 214 | "correct": "d", 215 | "answers_have_code": 0, 216 | "code": "" 217 | }, 218 | { 219 | "question": "Lo studio di fattibilità è un'attività volta a", 220 | "answers": [ 221 | "a proporre alcune strategie per la sua realizzazione", 222 | "stabilire se un prodotto è tecnicamente realizzabile", 223 | "tutti e tre", 224 | "stabilire se un prodotto è economicamente conveniente" 225 | ], 226 | "correct": "c", 227 | "answers_have_code": 0, 228 | "code": "" 229 | }, 230 | { 231 | "question": "Che relazione c'è tra la modularità di un progetto e l'organizzazione della modalità di sviluppo?", 232 | "answers": [ 233 | "La modularità permette la ripartizione del lavoro fra diversi gruppi di sviluppo.", 234 | "la prima permette una modalità distribuita della seconda", 235 | "sono la stessa cosa", 236 | "nessuna delle tre" 237 | ], 238 | "correct": "b", 239 | "answers_have_code": 0, 240 | "code": "" 241 | }, 242 | { 243 | "question": "Quali delle seguenti strategie è diretta ad una riduzione dell'impatto del rischio?", 244 | "answers": [ 245 | "tutte e tre", 246 | "Minimization strategies", 247 | "Avoidance strategies", 248 | "Contingency plans" 249 | ], 250 | "correct": "b", 251 | "answers_have_code": 0, 252 | "code": "" 253 | }, 254 | { 255 | "question": "Quale dei seguenti non è considerato un rischio in Project management?", 256 | "answers": [ 257 | "Testing", 258 | "avvicendamento del personale", 259 | "ritardi nelle specifiche", 260 | "Product competition" 261 | ], 262 | "correct": "a", 263 | "answers_have_code": 0, 264 | "code": "" 265 | }, 266 | { 267 | "question": "Quali rischi sono associati ai vincoli imposti dal management o dal mercato?", 268 | "answers": [ 269 | "Product size risks", 270 | "Process definition risks", 271 | "Business impact risks", 272 | "Development environment risks" 273 | ], 274 | "correct": "c", 275 | "answers_have_code": 0, 276 | "code": "" 277 | }, 278 | { 279 | "question": "Una risorsa di sistema che ha valore e deve essere protetta si chiama", 280 | "answers": [ 281 | "nessuno di questi", 282 | "control", 283 | "asset", 284 | "vulnerabilità" 285 | ], 286 | "correct": "c", 287 | "answers_have_code": 0, 288 | "code": "" 289 | }, 290 | { 291 | "question": "Le circostanze che hanno il potenziale di causare perdite o danno si chiamano", 292 | "answers": [ 293 | "attacco", 294 | "minaccia", 295 | "control", 296 | "vulnerabilità" 297 | ], 298 | "correct": "b", 299 | "answers_have_code": 0, 300 | "code": "" 301 | }, 302 | { 303 | "question": "Interaction Diagram è un termine composto per", 304 | "answers": [ 305 | "Activity Diagram + State Chart Diagram", 306 | "nessuno di questi", 307 | "Deployment Diagram + Collaboration Diagram", 308 | "Sequence Diagram + Collaboration Diagram" 309 | ], 310 | "correct": "a", 311 | "answers_have_code": 0, 312 | "code": "" 313 | }, 314 | { 315 | "question": "Quale/i di questi diagrammi è time-oriented ?", 316 | "answers": [ 317 | "Collaboration", 318 | "nessuno di questi", 319 | "Sequence", 320 | "Activity" 321 | ], 322 | "correct": "c", 323 | "answers_have_code": 0, 324 | "code": "" 325 | }, 326 | { 327 | "question": "Quale di questi diagrammi ha una view (visione) statica ?", 328 | "answers": [ 329 | "Activity", 330 | "Collaboration", 331 | "Use case", 332 | "State chart" 333 | ], 334 | "correct": "c", 335 | "answers_have_code": 0, 336 | "code": "" 337 | }, 338 | { 339 | "question": "Quale/i delle seguenti relazioni è/sono valida/e nei Use Case Diagrams ?", 340 | "answers": [ 341 | "Generalization", 342 | "Extend", 343 | "tutte quelle menzionate", 344 | "nessuna" 345 | ], 346 | "correct": "c", 347 | "answers_have_code": 0, 348 | "code": "" 349 | }, 350 | { 351 | "question": "Identificare la/le affermazione/i vere per gli activity diagrams.", 352 | "answers": [ 353 | "Tutte quelle menzionate", 354 | "Sono usati per descrivere il workflow di una particolare attività di business", 355 | "Non ci dicono chi fa cosa e non sono riconducibili agli object models", 356 | "Possono essere usati per scoprire attività parallele" 357 | ], 358 | "correct": "a", 359 | "answers_have_code": 0, 360 | "code": "" 361 | } 362 | ] -------------------------------------------------------------------------------- /json/so2_2025_mz.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "question": "Il seguente comando copia da filein a fileout 100 byte intervallati di 10 byte, ovvero byte_1, byte_11, byte_21, etc... Scegli un'alternativa:", 4 | "answers": [ 5 | "Falso", 6 | "Vero" 7 | ], 8 | "correct": "a", 9 | "answers_have_code": 0, 10 | "code": "dd if=filein of=fileout bs=1 seek=10 count=100" 11 | }, 12 | { 13 | "question": "Supponiamo di avere una directory '/home/dir' creata da root con permessi di accesso '0777/drwxrwxrwx (owner root)' ed al suo interno il file filename, creato da root, con permessi di accesso '0770/-rwxrwx--- (owner root)' Un qualsiasi utente puo' rimovere il file filename eseguendo, in user mode, il comando rm /home/dir/filename", 14 | "answers": [ 15 | "Vero", 16 | "Falso" 17 | ], 18 | "correct": "a", 19 | "answers_have_code": 0, 20 | "code": "", 21 | "img": "" 22 | }, 23 | { 24 | "question": "Si consideri il comando 'ln -s myfile mylink'.Dopo la sua esecuzione, l'output dei comandi \"du myfile\" e \"du mylink\" sara' diverso", 25 | "answers": [ 26 | "Falso", 27 | "Vero" 28 | ], 29 | "correct": "b", 30 | "answers_have_code": 0, 31 | "code": "", 32 | "img": "" 33 | }, 34 | { 35 | "question": "Il comando 'ls -r mydir' lista il contenuto di tutte le directory con radice \"mydir\".", 36 | "answers": [ 37 | "Vero", 38 | "Falso" 39 | ], 40 | "correct": "b", 41 | "answers_have_code": 0, 42 | "code": "", 43 | "img": "" 44 | }, 45 | { 46 | "question": "Nel comando '# cd ~/Lezione1/esempi/filesystem' e' stato utilizzato un path relativo", 47 | "answers": [ 48 | "Vero", 49 | "Falso" 50 | ], 51 | "correct": "b", 52 | "answers_have_code": 0, 53 | "code": "", 54 | "img": "" 55 | }, 56 | { 57 | "question": "Per visualizzare l'atime di un file quale dei seguenti comandi e' corretto?", 58 | "answers": [ 59 | "ls -lu nomefile", 60 | "Is -Ic nomefile", 61 | "ls -la nomefile" 62 | ], 63 | "correct": "a", 64 | "answers_have_code": 0, 65 | "code": "", 66 | "img": "" 67 | }, 68 | { 69 | "question": "Per visualizzare la lista dei file presenti nella CWD ordinati per modified time si utilizza il comando:", 70 | "answers": [ 71 | "ls -lt", 72 | "Is -lut", 73 | "ls -la" 74 | ], 75 | "correct": "a", 76 | "answers_have_code": 0, 77 | "code": "", 78 | "img": "" 79 | }, 80 | { 81 | "question": "Si supponga di avere un file di testo filein contenente 'abcdefghilmnopqrstuvwxyzABCDEFGHILMNOPQRSTUVWXYZ' dopo l'esecuzione del comando 'dd if=filein of=fileout bs=2 skip=3 count=10' cosa conterrà fileout?", 82 | "answers": [ 83 | "ghilmnopqrstuvwxyzAB", 84 | "ghilmnopqrstuvwxyzABCDEFGHILMN", 85 | "GHILMNOPQRSTUVWXYZ" 86 | ], 87 | "correct": "a", 88 | "answers_have_code": 0, 89 | "code": "", 90 | "img": "" 91 | }, 92 | { 93 | "question": "Il comando 'ls -ltc' restituisce la lista dei file nella CWD ordinati per atime", 94 | "answers": [ 95 | "Falso", 96 | "Vero" 97 | ], 98 | "correct": "a", 99 | "answers_have_code": 0, 100 | "code": "", 101 | "img": "" 102 | }, 103 | { 104 | "question": "Sia nomefile un file memorizzato nella CWD, il comando 'touch nomefile' crea un file vuoto che sostituisce il file esistente", 105 | "answers": [ 106 | "Falso", 107 | "Vero" 108 | ], 109 | "correct": "a", 110 | "answers_have_code": 0, 111 | "code": "", 112 | "img": "" 113 | }, 114 | { 115 | "question": "Il valore \"totale 1512\" del seguente codice rappresenta la dimensione della directory in numero di blocchi su disco", 116 | "answers": [ 117 | "Vero", 118 | "Falso" 119 | ], 120 | "correct": "a", 121 | "answers_have_code": 0, 122 | "code": "studente@debian9 :~ $ ls -l apache-tomcat-8.0.27/ \ntotale 1512 \ndrwxr-xr-x 2 studente studente", 123 | "img": "" 124 | }, 125 | { 126 | "question": "Un utente che appartiene al gruppo sudo puo' direttamente accedere, in scrittura, al file /etc/passwd", 127 | "answers": [ 128 | "Falso", 129 | "Vero" 130 | ], 131 | "correct": "a", 132 | "answers_have_code": 0, 133 | "code": "", 134 | "img": "" 135 | }, 136 | { 137 | "question": "Entrambi i path che seguono sono path assoluti per l'utente studente", 138 | "answers": [ 139 | "Vero", 140 | "Falso" 141 | ], 142 | "correct": "a", 143 | "answers_have_code": 0, 144 | "code": "studente@debian9:~$ /home/studente/dir1/dir2 \nstudente@debian9:~$ ~/dir1/dir2/", 145 | "img": "" 146 | }, 147 | { 148 | "question": "Consideriamo il file eseguibile myProgram con proprietario utente1 e con permessi di accesso -rwxr-xr-x, Se utente2 esegue myProgramma si osserva che il RUID = EUID", 149 | "answers": [ 150 | "Falso", 151 | "Vero" 152 | ], 153 | "correct": "b", 154 | "answers_have_code": 0, 155 | "code": "", 156 | "img": "" 157 | }, 158 | { 159 | "question": "Consideriamo il file eseguibile myProgram con proprietario utente1 e con permessi di accesso -rwsr-xr-x, Se utente2 esegue myProgramma si osserva che il RUID = EUID", 160 | "answers": [ 161 | "Falso", 162 | "Vero" 163 | ], 164 | "correct": "a", 165 | "answers_have_code": 0, 166 | "code": "", 167 | "img": "" 168 | }, 169 | { 170 | "question": "Supponiamo di avere una directory '/home/dir' creata da root con permessi di accesso '1777/drwxrwxrwt (owner root)' ed al suo interno il file filename, creato da root, con permessi di accesso '0770/-rwxrwx --- (owner root)'. Un qualsiasi utente puo' rimovere il file filename eseguendo, in user mode, il comando 'rm /home/dir/filename'", 171 | "answers": [ 172 | "Vero", 173 | "Falso" 174 | ], 175 | "correct": "b", 176 | "answers_have_code": 0, 177 | "code": "", 178 | "img": "" 179 | }, 180 | { 181 | "question": "I permessi di accesso del file eseguibile '/usr/bin/passwd' sono impostati a '4755/-rwsr-xr-x'. per impedire che un qualsiasi utente, operante in usermode, possa eseguire il comando passwd e quindi modificare il file '/etc/passwd'", 182 | "answers": [ 183 | "Vero", 184 | "Falso" 185 | ], 186 | "correct": "b", 187 | "answers_have_code": 0, 188 | "code": "", 189 | "img": "" 190 | }, 191 | { 192 | "question": "I permessi di accesso del file eseguibile '/usr/bin/passwd' sono impostati a '1755/-rwxr-xr-t' per consentire ad un qualsiasi utente, operante in usermode, di eseguire il comando passwd e quindi modificare il file '/etc/passwd'", 193 | "answers": [ 194 | "Vero", 195 | "Falso" 196 | ], 197 | "correct": "b", 198 | "answers_have_code": 0, 199 | "code": "", 200 | "img": "" 201 | }, 202 | { 203 | "question": "Il comando 'chmod 6774 nomefile' imposta i seguenti permessi per il file nomefile '- r w S r w S r - -'", 204 | "answers": [ 205 | "Falso", 206 | "Vero" 207 | ], 208 | "correct": "a", 209 | "answers_have_code": 0, 210 | "code": "", 211 | "img": "" 212 | }, 213 | { 214 | "question": "Il comando 'sudo adduser utente1 studente' genera un errore se il gruppo \"studente\" esiste ma l'utente \"utente1\" non esiste.", 215 | "answers": [ 216 | "Vero", 217 | "Falso" 218 | ], 219 | "correct": "a", 220 | "answers_have_code": 0, 221 | "code": "", 222 | "img": "" 223 | }, 224 | { 225 | "question": "Il comando 'touch -cat202006021200 filename' imposta l'atime ed il ctime di filename al '2 giugno 2020 ore 12:00'.", 226 | "answers": [ 227 | "Falso", 228 | "Vero" 229 | ], 230 | "correct": "a", 231 | "answers_have_code": 0, 232 | "code": "", 233 | "img": "" 234 | }, 235 | { 236 | "question": "Il comando 'ls -R mydir' lista il contenuto di tutte le directory con radice \"mydir\".", 237 | "answers": [ 238 | "Falso", 239 | "Vero" 240 | ], 241 | "correct": "b", 242 | "answers_have_code": 0, 243 | "code": "", 244 | "img": "" 245 | }, 246 | { 247 | "question": "Si assuma di avere due shell aperte, etichettate come shell_1 e shell_2 e si consideri la seguente sequenza di comandi (shell_i:cmd indica che cmd e' eseguitto nella shell i, i=1,2) eseguiti in usermode. Quale e' il loro effetto?", 248 | "answers": [ 249 | "Il processo xterm viene portato nello stato Interrupted (I)", 250 | "Nulla. Un segnale di SIGINT inviato in usermode non viene considerato dal processo che lo riceve.", 251 | "Il processo xterm viene terminato con segnale SIGINT" 252 | ], 253 | "correct": "c", 254 | "answers_have_code": 0, 255 | "code": "shell_1: xterm\nshell_2: ps -C xterm\n#restituisce xtermPID\nshell 2: kill -s SIGINT xtermPID", 256 | "img": "" 257 | }, 258 | { 259 | "question": "Si assuma di avere due shell aperte, etichettate come shell_1 e shell_2 e si consideri la seguente sequenza di comandi (shell_i:cmd indica che cmd e' eseguitto nella shell i, i=1,2) eseguiti in usermode. Quale e' il loro effetto?", 260 | "answers": [ 261 | "Il processo xterm viene messo nello stato T", 262 | "Nulla. In usermode l'invio di un segnale di SIGSTOP ad un processo non ha effetto", 263 | "Il processo xterm viene mandato in esecuzione in background" 264 | ], 265 | "correct": "a", 266 | "answers_have_code": 0, 267 | "code": "shell_1: xterm\nshell_2: ps -C xterm\n#restituisce xtermPID\nshell 2: kill -s SIGSTOP xtermPID", 268 | "img": "" 269 | }, 270 | { 271 | "question": "Per conoscere lo stato di un job in esecuzione si deve utilizzare il comando", 272 | "answers": [ 273 | "Falso", 274 | "Vero" 275 | ], 276 | "correct": "a", 277 | "answers_have_code": 0, 278 | "code": "~$ jobs -p", 279 | "img": "" 280 | }, 281 | { 282 | "question": "Il comando", 283 | "answers": [ 284 | "Crea l'utente usertest ma genera dati inconsistenti nel file /etc/passwd", 285 | "Genera un errore", 286 | "Crea l'utente usertest e la directory /home/usertest assegnandola come home directory all'utente" 287 | ], 288 | "correct": "a", 289 | "answers_have_code": 0, 290 | "code": "sudo adduser --home=/home/testdir --no-create-home usertest", 291 | "img": "" 292 | }, 293 | { 294 | "question": "I seguenti segnali possono essere catturati e gestiti da un programma c eseguito in usermode", 295 | "answers": [ 296 | "Vero", 297 | "Falso" 298 | ], 299 | "correct": "a", 300 | "answers_have_code": 0, 301 | "code": "SIGINT\nSIGABRT\nSIGTERM", 302 | "img": "" 303 | }, 304 | { 305 | "question": "I seguenti segnali non possono essere catturati e gestiti da un programma c eseguito in usermode", 306 | "answers": [ 307 | "Vero", 308 | "Falso" 309 | ], 310 | "correct": "b", 311 | "answers_have_code": 0, 312 | "code": "SIGKILL\nSIGINT\nSIGABRT", 313 | "img": "" 314 | }, 315 | { 316 | "question": "I comandi '~$ sudo -u usertest' e '~$ su -l usertest' sono equivalenti", 317 | "answers": [ 318 | "Vero", 319 | "Falso" 320 | ], 321 | "correct": "b", 322 | "answers_have_code": 0, 323 | "code": "", 324 | "img": "" 325 | }, 326 | { 327 | "question": "I seguenti comandi producono lo stesso risultato", 328 | "answers": [ 329 | "Vero", 330 | "Falso" 331 | ], 332 | "correct": "a", 333 | "answers_have_code": 0, 334 | "code": "dd if=filein of=fileout bs=100 count=1\ndd if=filein of=fileout bs=1 count=100", 335 | "img": "" 336 | }, 337 | { 338 | "question": "Supponiamo di avere un file di nome filename e di eseguire il comando 'ln filename link1' i file filename e link1 hanno inode diversi", 339 | "answers": [ 340 | "Vero", 341 | "Falso" 342 | ], 343 | "correct": "b", 344 | "answers_have_code": 0, 345 | "code": "", 346 | "img": "" 347 | }, 348 | { 349 | "question": "Si consideri il comando 'ln -s myfile mylink'. Dopo la sua esecuzione, myfile e mylink avranno un diverso inode.", 350 | "answers": [ 351 | "Vero", 352 | "Falso" 353 | ], 354 | "correct": "a", 355 | "answers_have_code": 0, 356 | "code": "", 357 | "img": "" 358 | }, 359 | { 360 | "question": "Il comando 'chmod 6774 nomefile' imposta i seguenti permessi per il file nomefile '- r w s r w s r - -'", 361 | "answers": [ 362 | "Falso", 363 | "Vero" 364 | ], 365 | "correct": "b", 366 | "answers_have_code": 0, 367 | "code": "", 368 | "img": "" 369 | }, 370 | { 371 | "question": "Assuma di avere due shell aperte, etichettate come shell_1 e shell_2 e supponga di eseguire, in usemode, la sequenza di comandi che segue (shell_i: cmd indica che cmd e' eseguitto nella shell_i, i=1,2). Quale e' il loro effetto sul processo xterm?", 372 | "answers": [ 373 | "Il processo sleep viene prima portato nello stato T e poi mandato nuovamente in esecuzione in foreground", 374 | "Il processo sleep viene mandato in esecuzione in background", 375 | "Nessuno. In usermode i processi ignorano il segnale di SIGSTOP. L'invio del segnale SIGCONT quindi non modifica lo stato del processo" 376 | ], 377 | "correct": "b", 378 | "answers_have_code": 0, 379 | "code": "shell_1: sleep 300\nshell_2: ps -C sleep\n#restituisce sleepPID\nshell_2: kill -s SIGSTOP sleepPID\nshell_2: kill -s SIGCONT sleepPID", 380 | "img": "" 381 | }, 382 | { 383 | "question": "Il comando ~$ sleep 30 | sleep 15 | sleep 10 & crea 1 job in background", 384 | "answers": [ 385 | "Falso", 386 | "Vero" 387 | ], 388 | "correct": "b", 389 | "answers_have_code": 0, 390 | "code": "", 391 | "img": "" 392 | }, 393 | { 394 | "question": "La directory /tmp ha i permessi di accesso impostati a 1777/drwxrwxrwt per consentire a tutti gli utenti di leggere, creare e rimuovere file anche se non hanno permessi di scrittura su di essi.", 395 | "answers": [ 396 | "Falso", 397 | "Vero" 398 | ], 399 | "correct": "a", 400 | "answers_have_code": 0, 401 | "code": "", 402 | "img": "" 403 | }, 404 | { 405 | "question": "Consideriamo il file eseguibile myProgram con proprietario utente1 e con permessi di accesso -rwxr-xr-x. Se utente2 esegue myProgram si osserva che il RUID è diverso dal EUID", 406 | "answers": [ 407 | "Falso", 408 | "Vero" 409 | ], 410 | "correct": "a", 411 | "answers_have_code": 0, 412 | "code": "", 413 | "img": "" 414 | }, 415 | { 416 | "question": "Supponiamo di avere una directory '/home/dir' creata da root con permessi di accesso '1777/drwxrwxrwt (owner root)' ed al suo interno il file filename, creato da root, con permessi di accesso '0770/-rwxrwx--- (owner root)' Un qualsiasi utente puo' rimovere il file filename eseguendo, in user mode, il comando rm /home/dir/filename", 417 | "answers": [ 418 | "Vero", 419 | "Falso" 420 | ], 421 | "correct": "b", 422 | "answers_have_code": 0, 423 | "code": "", 424 | "img": "" 425 | }, 426 | { 427 | "question": "Per eseguire con successo il comando studente@hostname~$ sudo -u usertest stat file_di_usertest quale password deve essere fornita?", 428 | "answers": [ 429 | "La password dell'utente usertest", 430 | "La password dell'utente studente", 431 | "La password di root" 432 | ], 433 | "correct": "b", 434 | "answers_have_code": 0, 435 | "code": "", 436 | "img": "" 437 | }, 438 | { 439 | "question": "Il comando adduser utente1; adduser utente1 studente , dopo aver creato l'utente utente1, genera errore nell'esecuzione del secondo comando in quanto utente1 esiste già.", 440 | "answers": [ 441 | "Vero", 442 | "Falso" 443 | ], 444 | "correct": "b", 445 | "answers_have_code": 0, 446 | "code": "", 447 | "img": "" 448 | }, 449 | { 450 | "question": "Dopo l'esecuzione del comando ln filename link1, il comando \"stat filename\" e \"stat link1\" avranno output uguale a meno del campo \"File\".", 451 | "answers": [ 452 | "Vero", 453 | "Falso" 454 | ], 455 | "correct": "a", 456 | "answers_have_code": 0, 457 | "code": "", 458 | "img": "" 459 | }, 460 | { 461 | "question": "Una directory con i permessi di accesso settati a rw- --- --- permette all'utente proprietario della directory di: leggere il contenuto della directory inclusi gli attributi del file; impostare la directory come cwd; attraversare la directory;", 462 | "answers": [ 463 | "Vero", 464 | "Falso" 465 | ], 466 | "correct": "b", 467 | "answers_have_code": 0, 468 | "code": "", 469 | "img": "" 470 | } 471 | 472 | ] 473 | -------------------------------------------------------------------------------- /js/main.js: -------------------------------------------------------------------------------- 1 | // vars 2 | var timer = true; // set timer 3 | var shuffleQuestionMode = true // shuffle questions 4 | var shuffleAnswerMode = true // shuffle answers 5 | 6 | // JS Vars 7 | var timeUpd 8 | var pResults 9 | var questions // questions and answers parsed from JSON 10 | var slider 11 | var outslider 12 | var h3Explaination 13 | 14 | const format = (num, places) => String(num).padStart(places, '0') // one-line: prints zeros before strings 15 | 16 | // func: if it is a string, return true 17 | function isString(x) { 18 | return Object.prototype.toString.call(x) === '[object String]'; 19 | } 20 | 21 | // func: it creates a select box 22 | // @params: selected if entry has been selected 23 | function createSelectBox(selectId, optText, optValue, selected) { 24 | 25 | // get our select quiz-version 26 | var select = document.getElementById(selectId) 27 | 28 | // create new option element 29 | var opt = document.createElement('option'); 30 | 31 | // create text node 32 | opt.appendChild(document.createTextNode(optText)); 33 | 34 | // set value 35 | opt.value = optValue; 36 | 37 | selected ? opt.selected = true : opt.selected = false 38 | 39 | // add opt to end of select box 40 | select.appendChild(opt); 41 | } 42 | 43 | function changeAnswers() { 44 | numberOfQuestions = slider.value; 45 | restart() 46 | } 47 | 48 | /* 49 | 0: it is a normal human understandable int, 1: the variable is an int > 0 and < MAX_SAFE_INTEGER * 50 | @params: variable: variable to check, nameOfVar: name of that variable, allowsZero: true if you allow zero value 51 | */ 52 | function checkForBadInt(variable, nameOfVar, allowsZero) { 53 | lowerBound = allowsZero ? -1 : 0 54 | 55 | // not an integer 56 | if (!Number.isInteger(variable)) { 57 | console.log(nameOfVar + " must be a number") 58 | document.getElementById("container").innerHTML = nameOfVar + " must be a number >= 0 in config.js. Make sure to set that variable in a correct way and try again!" 59 | return 1 60 | } 61 | 62 | // nMinutes it is <= 0 or > MAX_SAFE_INTEGER 63 | if (variable <= lowerBound || variable > Number.MAX_SAFE_INTEGER) { 64 | console.log(nameOfVar + " value <= 0 or value > of " + Number.MAX_SAFE_INTEGER) 65 | document.getElementById("container").innerHTML = nameOfVar + " must be a number >= 0 and <= than " + Number.MAX_SAFE_INTEGER + " in config.js. Make sure to set that variable in a correct way and try again!" 66 | return 1 67 | } 68 | return 0 69 | } 70 | 71 | function undefinedIntegerCheck(variable, variableName, errHtmlString, allowsZero) { 72 | // check for nMinutes 73 | if (typeof variable === 'undefined') { 74 | console.log("Undefined " + variableName) 75 | document.getElementById("container").innerHTML = errHtmlString 76 | return 1 77 | } else { 78 | if (checkForBadInt(variable, variableName, allowsZero)) { 79 | return 1 80 | } 81 | } 82 | } 83 | 84 | // useful for printing from stackoverflow 85 | const varToString = varObj => Object.keys({ varObj })[0] 86 | 87 | function undefinedBadTypeCheck(variable, expectedType, allowsZero) { 88 | // check for nMinutes 89 | if (typeof variable === 'undefined') { 90 | console.log("Undefined " + varToString({ variable })) 91 | document.getElementById("container").innerHTML = "Undefined " + varToString({ variable }) + "in config.js. Make sure to set that variable in a correct way and try again!" 92 | return 1 93 | } else { 94 | if (typeof variable !== expectedType) { 95 | console.log(varToString({ variable }) + " is not a " + varToString({ expectedType })) 96 | document.getElementById("container").innerHTML = varToString({ variable }) + " must be a " + expectedType + " in config.js. Make sure to set that variable in a correct way and try again!" 97 | return 1 98 | } 99 | 100 | // check if bad int 101 | if (typeof variable === "integer") { 102 | if (typeof allowsZero === 'undefined') allowsZero = false 103 | if (checkForBadInt(variable, variableName, allowsZero)) { 104 | return 1 105 | } 106 | } 107 | 108 | } 109 | } 110 | 111 | // check: things exist, if yes load them correctly 112 | function checkForParams() { 113 | //////////////////////// 114 | /// INTEGRITY CHECKS // 115 | //////////////////////// 116 | if ( 117 | undefinedBadTypeCheck(nMinutes, "number", true) == -1 || 118 | undefinedBadTypeCheck(correctAnswerPoints, "number", true) == -1 || 119 | undefinedBadTypeCheck(wrongAnswerPoints, "number", true) == -1 || 120 | undefinedBadTypeCheck(noAnswerPoints, "number", true) == -1 || 121 | undefinedBadTypeCheck(numberOfQuestions, "number", false) == -1) { 122 | return 1; 123 | } 124 | 125 | if ( 126 | undefinedBadTypeCheck(showSlider, "boolean") == -1 || 127 | undefinedBadTypeCheck(showTimer, "boolean") == -1 || 128 | undefinedBadTypeCheck(showShuffleQuestions, "boolean") == -1 || 129 | undefinedBadTypeCheck(showShuffleAnswers, "boolean") == -1 || 130 | undefinedBadTypeCheck(jsonFolder, "string") == -1) { 131 | return 1; 132 | } 133 | 134 | return 0 135 | 136 | } 137 | 138 | function getCustomLink() { 139 | return customLink; 140 | } 141 | 142 | // func: handle things related to timer (start / end timer) 143 | function timerHandler(timer) { 144 | if (!showTimer) { 145 | timer = false 146 | } else { 147 | // if timer is disabled, then you shouldn't render anything 148 | if (!timer) { 149 | document.getElementById("end").innerHTML = ""; 150 | document.getElementById("timeleft").innerHTML = ""; 151 | 152 | clearInterval(timeUpd) 153 | } else { 154 | clearInterval(timeUpd) 155 | timeStart() 156 | } 157 | } 158 | } 159 | 160 | // func: initialize things, checking if each variable has everything 161 | function init() { 162 | 163 | slider = document.getElementById("sliderQuestionsNumber") 164 | outslider = document.getElementById("sliderText") 165 | h3Explaination = document.getElementById("h3Explaination") 166 | 167 | slider.oninput = function () { 168 | outslider.innerHTML = this.value; 169 | } 170 | 171 | 172 | // managing hidden elements if proper variables have been set 173 | // show / hide timer 174 | if (!showTimer) { 175 | document.getElementById("div-chk-timer").hidden = true 176 | timer = false 177 | } 178 | 179 | // show / hide slider 180 | if (!showSlider) { 181 | document.getElementById("div-slider").hidden = true 182 | } 183 | 184 | // show / hide shuffle questions 185 | if (!showShuffleQuestions) { 186 | document.getElementById("div-chk-shuffle-questions").hidden = true 187 | shuffleQuestionMode = false 188 | } 189 | 190 | // show / hide shuffle answers 191 | if (!showShuffleAnswers) { 192 | document.getElementById("div-chk-shuffle-answers").hidden = true 193 | shuffleAnswerMode = false 194 | } 195 | 196 | // check: params must be valid 197 | if (checkForParams() != 0) { 198 | return 1 199 | } 200 | 201 | // evt: cbx-quiz-version 202 | document.getElementById('quiz-version').onchange = function () { 203 | numberOfQuestions = slider.value; 204 | 205 | pResults = document.getElementById("results") 206 | pResults.hidden = true 207 | clearBox("container") 208 | clearInterval(timeUpd) 209 | 210 | if (buildFromJSON(this.value) == 0) { 211 | document.getElementById("end").innerHTML = ""; 212 | 213 | // timer handler 214 | timerHandler(timer) 215 | 216 | document.getElementById("btn-send").style.visibility = "visible"; 217 | } 218 | } 219 | 220 | // evt: reload-button 221 | document.getElementById('btn-quiz-reload').onclick = function () { 222 | restart() 223 | } 224 | // evt: chk-shuffle-questions 225 | document.getElementById("chk-shuffle-questions").onclick = function () { 226 | shuffleQuestionMode = !shuffleQuestionMode 227 | restart() 228 | } 229 | 230 | // evt: chk-shuffle-answers 231 | document.getElementById("chk-shuffle-answers").onclick = function () { 232 | shuffleAnswerMode = !shuffleAnswerMode 233 | restart() 234 | } 235 | 236 | // evt: chk-timer enable / disable 237 | document.getElementById("chk-timer").onclick = function () { 238 | // timer handler 239 | 240 | timer = !timer 241 | timerHandler(timer) 242 | } 243 | 244 | h3Explaination.innerText = "+" + correctAnswerPoints + " for each correct answer, -" + wrongAnswerPoints + " for each wrong answer, +" + noAnswerPoints + " for each no answer" 245 | 246 | // check: JSONFile exist => if not it will not load 247 | if (typeof jsonFiles === 'undefined' || jsonFiles.constructor != Object) { 248 | console.log("Undefined jsonFiles") 249 | document.getElementById('container').innerHTML = "Undefined jsonFiles in config.js. Make sure to set that variable in a correct way and try again!"; 250 | clearInterval(timeUpd) 251 | slider.disabled = true 252 | document.getElementById("btn-send").hidden = true 253 | document.getElementById("btn-quiz-reload").disabled = true 254 | document.getElementById("chk-timer").disabled = true 255 | document.getElementById("chk-shuffle-answers").disabled = true 256 | document.getElementById("chk-shuffle-questions").disabled = true 257 | 258 | return 1 259 | 260 | } else { 261 | // default file to show at the beginning 262 | defaultFile = Object.keys(jsonFiles)[0] 263 | 264 | if (buildFromJSON(defaultFile) == 0) { 265 | // timer handler 266 | timerHandler(timer) 267 | } 268 | 269 | return 0; 270 | } 271 | } 272 | 273 | // func: restart the game 274 | function restart() { 275 | pResults = document.getElementById("results") 276 | pResults.hidden = true 277 | clearBox("container") 278 | clearInterval(timeUpd) 279 | 280 | if (buildFromJSON(document.getElementById('quiz-version').value) == 0) { 281 | // timer handler 282 | timerHandler(timer) 283 | 284 | document.getElementById("btn-send").style.visibility = "visible"; 285 | } 286 | } 287 | 288 | // func: delete a box (div) 289 | function clearBox(elementID) { 290 | var div = document.getElementById(elementID) 291 | 292 | while (div.firstChild) { 293 | div.removeChild(div.firstChild) 294 | } 295 | } 296 | 297 | // func: disable components showing a proper error message 298 | function disableComponents(path, jsonFolder) { 299 | cont = document.getElementById("container") 300 | cont.innerHTML = "ERROR: " + path + " doesn't exist. Make sure to have a file named in this way in your \"" + jsonFolder + "\" folder." 301 | cont.appendChild(document.createElement('div')) 302 | clearInterval(timeUpd) 303 | document.getElementById("timeleft").innerHTML = "" 304 | document.getElementById("btn-send").disabled = true 305 | document.getElementById("btn-send").hidden = true 306 | } 307 | 308 | // func: set a countdown 309 | function timeStart() { 310 | var countDownDate = new Date() 311 | countDownDate.setMinutes(countDownDate.getMinutes() + nMinutes) 312 | 313 | timeUpd = setInterval(function () { 314 | var now = new Date().getTime() 315 | var timeleft = countDownDate - now; 316 | 317 | // calcola minuti e secondi rimasti 318 | var seconds = Math.floor((timeleft % (1000 * 60)) / 1000) 319 | var minutes = Math.floor((timeleft % (1000 * 60 * 60)) / (1000 * 60)) 320 | 321 | // mostra quanto tempo manca all'inizio 322 | document.getElementById("timeleft").innerHTML = format(minutes, 2) + ":" + format(seconds, 2) 323 | 324 | // tempo scaduto 325 | if (timeleft < 0) { 326 | clearInterval(timeUpd) 327 | document.getElementById("timeleft").innerHTML = "" 328 | document.getElementById("end").innerHTML = "TEMPO SCADUTO!"; 329 | 330 | validate() 331 | } 332 | }, 1000) 333 | } 334 | 335 | // pure shuffle --> https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array 336 | function pureShuffle(array) { 337 | var currentIndex = array.length, 338 | randomIndex; 339 | 340 | // While there remain elements to shuffle... 341 | while (0 !== currentIndex) { 342 | 343 | // Pick a remaining element... 344 | randomIndex = Math.floor(Math.random() * currentIndex); 345 | currentIndex--; 346 | 347 | // And swap it with the current element. 348 | [array[currentIndex], array[randomIndex]] = [ 349 | array[randomIndex], array[currentIndex] 350 | ]; 351 | } 352 | 353 | return array; 354 | } 355 | 356 | // func: shuffle two arrays with the same shuffled order 357 | function shuffle(obj1, obj2) { 358 | var index = obj1.length; 359 | var rnd, tmp1, tmp2; 360 | 361 | while (index) { 362 | rnd = Math.floor(Math.random() * index) 363 | index -= 1; 364 | tmp1 = obj1[index]; 365 | tmp2 = obj2[index]; 366 | obj1[index] = obj1[rnd]; 367 | obj2[index] = obj2[rnd]; 368 | obj1[rnd] = tmp1; 369 | obj2[rnd] = tmp2; 370 | } 371 | } 372 | 373 | // func: parse JSON if json loads successfully + build the webpage 374 | function buildFromJSON(path) { 375 | // if file exists load it, if not just exit 376 | 377 | // determining if I need to shuffle questions or not 378 | if (shuffleQuestionMode) { 379 | fetch(jsonFolder + "/" + path) 380 | .then( 381 | function (response) { 382 | if (response.status !== 200) { 383 | console.log('Status Code: ' + 384 | response.status); 385 | disableComponents(path, jsonFolder) 386 | return 1; 387 | } 388 | 389 | // parse my json 390 | response.json().then(data => questions = data) 391 | .then(() => numberOfQuestions > questions.length ? numberOfQuestions = questions.length : numberOfQuestions = numberOfQuestions) 392 | .then(() => questions = pureShuffle(questions)) // randomize questions 393 | .then(() => loadElements(questions)) // build the webpage 394 | } 395 | ) 396 | .catch(function (err) { 397 | console.log('Error:', err); 398 | disableComponents(path, jsonFolder) 399 | return 1 400 | }); 401 | } else { 402 | fetch(jsonFolder + "/" + path) 403 | .then( 404 | function (response) { 405 | if (response.status !== 200) { 406 | console.log('Looks like there was a problem. Status Code: ' + 407 | response.status); 408 | disableComponents(path, jsonFolder) 409 | return 1; 410 | } 411 | 412 | response.json().then(data => questions = data) 413 | // this line fixes the number of question if the number of questions you want to show is greater than the total number of questions 414 | .then(() => numberOfQuestions > questions.length ? numberOfQuestions = questions.length : numberOfQuestions = numberOfQuestions) 415 | .then(() => questions = questions) // do not randomize 416 | .then(() => loadElements(questions)) 417 | } 418 | ) 419 | .catch(function (err) { 420 | console.log('Error:', err); 421 | disableComponents(path, jsonFolder) 422 | return 1 423 | }); 424 | } 425 | 426 | return 0 427 | } 428 | // func: load elements in the webpage 429 | function loadElements(questions) { 430 | var container = document.getElementById('container'); 431 | 432 | for (i = 0; i < numberOfQuestions; i++) { 433 | var card = document.createElement('div'); 434 | card.classList.add('my-4', 'p-4', 'card', 'rounded'); 435 | container.appendChild(card); 436 | 437 | const questionHeader = document.createElement('div'); 438 | const boldText = document.createElement('b'); 439 | const questionText = document.createTextNode(`${i + 1}. ${questions[i].question}`); 440 | boldText.style.color = 'blue'; 441 | boldText.appendChild(questionText); 442 | questionHeader.appendChild(boldText); 443 | questionHeader.id = 'question'; 444 | card.appendChild(questionHeader); 445 | 446 | // image to show, if any 447 | if (questions[i]['img'] !== undefined && questions[i]['img'].length > 0) { 448 | var img = document.createElement("img") 449 | 450 | // TODO: this wont work for JPG 451 | // if a file already have png extension dont add png 452 | if (!questions[i]['img'].includes(".png")) { 453 | questions[i]['img'] = questions[i]['img'] + ".png" 454 | } 455 | 456 | img.src = "img/" + questions[i]['img'].toString(); 457 | img.style.maxWidth = "50%"; 458 | card.appendChild(img) 459 | } 460 | 461 | // let's shuffle arrays together 462 | var answers = questions[i]['answers']; 463 | var replyNumber = Array.from(Array(answers.length).keys()) 464 | 465 | // managing shuffle 466 | if (shuffleAnswerMode) { 467 | shuffle(answers, replyNumber) 468 | } 469 | 470 | // let's calculate the correct answer 471 | var correctAnswerText = questions[i]['correct'].toLowerCase().charCodeAt(0) - 97 // number from letter 472 | correctAnswerText = replyNumber.findIndex((element) => element == correctAnswerText) // retrieve from shuffled array and save the new "correct answer" from shuffled indexes 473 | 474 | // if question has source code, then renderize it into a div 475 | if (questions[i]['code'] !== undefined && questions[i]['code'].length > 0) { 476 | var codeDiv = document.createElement('div'); 477 | var codeBlock = document.createElement('pre'); 478 | var codeText = document.createTextNode(questions[i]['code']); 479 | codeBlock.appendChild(codeText); 480 | codeDiv.appendChild(codeBlock); 481 | card.appendChild(codeDiv); 482 | } 483 | 484 | // for each answer in the JSON file 485 | for (j = 0; j < answers.length; j++) { 486 | var answerContainer = document.createElement('div'); 487 | answerContainer.classList.add('form-check'); 488 | 489 | var radiobox = document.createElement('input'); 490 | radiobox.classList.add('form-check-input'); 491 | radiobox.id = 'answer' + i + "." + j; 492 | radiobox.type = 'radio'; 493 | radiobox.name = 'radioBtns' + i; 494 | radiobox.value = replyNumber[j]; 495 | 496 | var lblAnswer = document.createElement('label'); 497 | lblAnswer.classList.add('form-check-label'); 498 | lblAnswer.classList.add('answer-label'); 499 | lblAnswer.htmlFor = 'answer' + i + "." + j; 500 | 501 | // if answers_have_code == 1 *in json* then let's render our answers as code in a pre block 502 | if (questions[i]['answers_have_code']) { 503 | var description = document.createElement('pre'); 504 | description.classList.add('answer-code'); 505 | description.textContent = answers[j]; 506 | } else { 507 | var description = document.createTextNode(" " + answers[j]); 508 | } 509 | lblAnswer.appendChild(description); 510 | 511 | answerContainer.appendChild(radiobox); 512 | answerContainer.appendChild(lblAnswer); 513 | card.appendChild(answerContainer); 514 | }; 515 | 516 | // define radiobutton for "no answer" option 517 | var noAnswerContainer = document.createElement('div'); 518 | noAnswerContainer.classList.add('form-check'); 519 | 520 | var radiobox = document.createElement('input'); 521 | radiobox.classList.add('form-check-input'); 522 | radiobox.id = 'answer' + i + ".noAnswer"; 523 | radiobox.type = 'radio'; 524 | radiobox.name = 'radioBtns' + i; 525 | radiobox.value = "s"; 526 | radiobox.checked = true; // settato a true di default 527 | 528 | var lblAnswer = document.createElement('label'); 529 | lblAnswer.classList.add('form-check-label'); 530 | lblAnswer.htmlFor = 'answer' + i + ".noAnswer"; 531 | 532 | var description = document.createTextNode(" No answer"); 533 | lblAnswer.appendChild(description); 534 | 535 | noAnswerContainer.appendChild(radiobox); 536 | noAnswerContainer.appendChild(lblAnswer); 537 | card.appendChild(noAnswerContainer); 538 | 539 | // let's add our hidden span containing the correct answer 540 | var answer = document.createElement('span'); 541 | answer.textContent = correctAnswerText; 542 | answer.hidden = true; 543 | answer.id = 'span' + i; 544 | card.appendChild(answer); 545 | 546 | var newline = document.createElement('br'); 547 | 548 | card.appendChild(newline); 549 | container.appendChild(card); 550 | } 551 | } 552 | 553 | // func: check and calculate correct, wrong or skipped answers at the end of time or if send button is pressed 554 | function validate() { 555 | contSkip = 0; 556 | contCorrect = 0; 557 | contWrong = 0; 558 | score = 0; 559 | 560 | for (i = 0; i < numberOfQuestions; i++) { 561 | var buttons = document.getElementsByName("radioBtns" + i) 562 | var correctAnswer = document.getElementById("span" + i) 563 | var result = -1; 564 | var checked = -1; 565 | 566 | // disable all radiobuttons to prevent user enters more data 567 | for (j = 0; j < buttons.length; j++) { 568 | buttons[j].onclick = function() { 569 | return false; // prevent further changes 570 | }; 571 | } 572 | 573 | // let's cycle our buttons 574 | // if last button has been selected, then the answer has been skipped 575 | if (buttons[buttons.length - 1].checked) { 576 | contSkip++ 577 | noAnswerPoints++ 578 | 579 | // the correct answer was... 580 | var correctNumber = correctAnswer.textContent 581 | 582 | var inputElement = buttons[correctNumber]; 583 | var lblElement = inputElement.nextElementSibling 584 | lblElement.style.backgroundColor = "#FFFF66"; 585 | if(lblElement.firstChild.nodeName === "TEXTAREA") { 586 | lblElement.firstChild.style.backgroundColor = "#FFFF66"; 587 | } 588 | 589 | } else { 590 | // if one of the buttons contains the correct answer, let's set the boolean to true 591 | for (j = 0; j < (buttons.length - 1); j++) { // -1 because skipped answer has already been analyzed before 592 | if (buttons[j].checked) { 593 | checked = j; // save what the user has checked 594 | 595 | if (("" + j) === correctAnswer.textContent) { 596 | result = j; // if it is the correct answer breaks everything! 597 | break; 598 | } 599 | } 600 | } 601 | 602 | var inputElement = buttons[checked]; // get checked element 603 | var lblElement = inputElement.nextElementSibling; // get its label 604 | 605 | if (result != -1) { 606 | // if it's the correct answer, then color the label in green 607 | lblElement.style.backgroundColor = "#00FF00"; 608 | if(lblElement.firstChild.nodeName === "TEXTAREA") { 609 | lblElement.firstChild.style.backgroundColor = "#00FF00"; 610 | } 611 | score += correctAnswerPoints; 612 | contCorrect++; 613 | } else { 614 | // it's the wrong answer, then, color the label will be red 615 | lblElement.style.backgroundColor = "#FF0000"; 616 | if(lblElement.firstChild.nodeName === "TEXTAREA") { 617 | lblElement.firstChild.style.backgroundColor = "#FF0000"; 618 | } 619 | 620 | 621 | // the correct answer was... 622 | var correctNumber = correctAnswer.textContent 623 | 624 | var inputElement = buttons[correctNumber]; // the correct one is saved in "num" variable 625 | var lblElement = inputElement.nextElementSibling 626 | lblElement.style.backgroundColor = "#00FF00"; 627 | if(lblElement.firstChild.nodeName === "TEXTAREA") { 628 | lblElement.firstChild.style.backgroundColor = "#00FF00"; 629 | } 630 | 631 | score -= wrongAnswerPoints; 632 | contWrong++; 633 | } 634 | } 635 | } 636 | 637 | // results at the end of the page 638 | pResults = document.getElementById("results"); 639 | pResults.innerHTML = 640 | "Correct: " + contCorrect + "" + "
" + 641 | "Wrong: " + contWrong + "" + "
" + 642 | "No answer: " + contSkip + "" + "
" + 643 | "Score: " + score + "/" + (numberOfQuestions * correctAnswerPoints) + "" + "
"; 644 | 645 | pResults.hidden = false; 646 | 647 | // TODO: trovare un modo migliore per fare ciò rispeto a fare un copia-incolla 648 | // fa un popup contenente il testo "copia" dell'innerhtml 649 | document.getElementById("btn-send").style.visibility = "hidden"; 650 | 651 | // Classic mode no bootstrap alert 652 | if (document.getElementById('chk-toggle-bootstrap').checked) { 653 | // Display results in the Bootstrap modal 654 | var resultModalBody = document.getElementById("resultModalBody"); 655 | resultModalBody.innerHTML = pResults.innerHTML; 656 | 657 | var resultModal = new bootstrap.Modal(document.getElementById('resultModal')); 658 | resultModal.show(); 659 | 660 | // set the timer to zero 661 | document.getElementById("timeleft").innerHTML = ""; 662 | clearInterval(timeUpd); 663 | } 664 | else { 665 | // Display results in the classic modal 666 | alert(pResults.innerText); 667 | } 668 | } 669 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /json/cc.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "question": "Why the Google File System uses large chunk?", 3 | "answers": [ 4 | "To maximize the read and write throughput", 5 | "To optimize performance for large files and to reduce the amount of metadata maintained by the system", 6 | "To avoid network disconnections during the file access", 7 | "To minimize the seek time", 8 | "To reduce the time needed to replicate the chunks", 9 | "To reduce the number of access to the same chunk" 10 | ], 11 | "correct": "b" 12 | }, 13 | { 14 | "question": "Which is the key operation performed by the MapReduce framework (like Hadoop) that allow to properly execute the Reduce task(s) after the completion of Map tasks?", 15 | "answers": [ 16 | "Combine", 17 | "There is no need of any specific operation", 18 | "Shuffle and sort", 19 | "Shuffle and Combine", 20 | "Combine and sort" 21 | ], 22 | "correct": "c" 23 | }, 24 | { 25 | "question": "What is the key idea behind MapReduce?", 26 | "answers": [ 27 | "Master - Slave algorithm design paradigm", 28 | "Single Data Multiple Processing algorithm design paradigm", 29 | "Batch parallel processing", 30 | "Data Stream processing", 31 | "Divide and conquer algorithm design paradigm" 32 | ], 33 | "correct": "e" 34 | }, 35 | { 36 | "question": "Assume you setup a multi-threshold scale-out policy with two thresholds on the CPU utilization (Ucpu), namely Tcpu1=50% of max CPU utilization and Tcpu2=80% of max CPU utilization. A scaling action start if (see the figure): \n\n( Ucpu > Tcpu1 ) OR ( Ucpu > Tcpu2 ) AND (the threshold is exceeded for more than 300 seconds). \n\nWhy is important to wait a certain time interval before starting a scaling action?", 37 | "figure": "alarms", 38 | "answers": [ 39 | "Because 300 secs is the time required by a new instance to start and to join the scaling group", 40 | "To limit the number of alarms generated in a given time interval, e.g. one hours.", 41 | "To avoid ping-pong effects that make the scaling policy unstable", 42 | "To guarantee that the added resources are warm-up" 43 | ], 44 | "correct": "c" 45 | }, 46 | { 47 | "question": "Which of the following are essential characteristics of cloud computing? (as defined by NIST)", 48 | "answers": [ 49 | "Broad network access; Resource pooling; virtualization", 50 | "On-demand self-service; Broad network access; and rapid elasticity ", 51 | "Resource pooling; Measured Services; and Scalability" 52 | ], 53 | "correct": "b" 54 | }, 55 | { 56 | "question": "Which of the following are essential characteristics of cloud computing? (as defined by NIST)", 57 | "answers": [ 58 | "Resource pooling; Measured Services; and Scalability", 59 | "On-demand self-service; scalability; and monitoring", 60 | "Resource pooling; rapid elasticity; and measured services" 61 | ], 62 | "correct": "c" 63 | }, 64 | { 65 | "question": "Which, among the following definitions describe the MAPE-K cycle", 66 | "answers": [ 67 | "The control loop for scaling, load balancing and VMs migration.", 68 | "The control loop implemented by an autonomic manager", 69 | "The control loop executed by a cloud monitor", 70 | "The control loop executed to build the Knowledge about the system state", 71 | "The monitoring, analytics, placement and execution control loop" 72 | ], 73 | "correct": "b" 74 | }, 75 | { 76 | "question": "Suppose that you would like to deploy a web application composed by: a frontend server to receive http requests and produce http reply/; a business logic server to build the content of the web pages; a database server, used by the business logic to extract information. Suppose also that the business logic component should scale (horizontally). Which system architectural style/model could be used for the deployment?", 77 | "answers": [ 78 | "Microservice architecture model", 79 | "Multi-tier client-server architecture model", 80 | "Service oriented architecture model", 81 | "IaaS architecture model" 82 | ], 83 | "correct": "b" 84 | }, 85 | { 86 | "question": "Which type of scalability is facilitated by microservices", 87 | "answers": [ 88 | "Scaling of single functions", 89 | "Application cloning", 90 | "Scaling of function's data" 91 | ], 92 | "correct": "a" 93 | }, 94 | { 95 | "question": "Which are the business drivers for cloud computing?", 96 | "answers": [ 97 | "Capacity Planning, Increase of business revenue, Agility", 98 | "Capacity Planning, Cost Reduction, Business Agility", 99 | "DevOp, Capacity Planning, Increased Security" 100 | ], 101 | "correct": "b" 102 | }, 103 | { 104 | "question": "Assume that you are setting up a scalable web server with AWS and that for your autoscaling group you have configure a step scaling policy. You have decided to set the alarm to start the scale-out with a threshold on the incoming traffic. Which of the following assertions is true?", 105 | "answers": [ 106 | "The alarm occurs if for the majority of the instances in the scaling group the value of the incoming traffic exceeds the threshold (e.g. for 3 out of 5).", 107 | "The alarm occurs if the average value of the incoming traffic computed over all the instances in the scaling group exceed the threshold.", 108 | "The alarm occurs if there is at least an instance in the scaling group with the value of the incoming traffic exceeding the threshold.", 109 | "The alarm occurs if for a user configured number of the instances in the scaling group the value of the incoming traffic exceeds the threshold.", 110 | "The alarm occurs if for all the instances in the scaling group the value of the incoming traffic exceeds the threshold." 111 | ], 112 | "correct": "b" 113 | }, 114 | { 115 | "question": "In what differ microservices and the SOA?", 116 | "answers": [ 117 | "Communication mechanisms, Data handling, and Size of the services", 118 | "Communication protocols, data storage solutions, complexity of the service", 119 | "Communication mechanisms, Data partitioning, Coupling of the services" 120 | ], 121 | "correct": "a" 122 | }, 123 | { 124 | "question": "Assume that you are deploying a set of containers and that the network stack of the containers should not be isolated from the Docker host. Which of the following network drivers will you use?", 125 | "answers": [ 126 | "Macvlan networks", 127 | "User-defined bridge networks", 128 | "Host Networks", 129 | "Overlay networks" 130 | ], 131 | "correct": "c" 132 | }, 133 | { 134 | "question": "What is the difference between hypervisor of type I and hypervisor of type II?", 135 | "answers": [ 136 | "Type I hypervisors run directly on top of the hardware of the host server and Type II hypervisors run on top of the operating system of the host server.", 137 | "Type I hypervisors use hardware assisted virtualization and type II hypervisors use software assisted virtualization", 138 | "Type I hypervisors use para-virtualization and type II hypervisors use full virtualization", 139 | "Type I hypervisors use binary translation and type II hypervisors use hypercalls" 140 | ], 141 | "correct": "a" 142 | }, 143 | { 144 | "question": "Consider the live migration process and in the specific the “iterative pre-copy” step. Why the memory is copied iteratively?", 145 | "answers": [ 146 | "To preserve continuity in the migration process", 147 | "To make, step-by-step, the dirty portion of the memory, on the VM to be migrated, small enough to handle the final copy ", 148 | "Because usually the memory of a VMs is too large to be transferred in one shot.", 149 | "Because to transfer the memory of a VM in one shout consume too much bandwidth", 150 | "To avoid overload on the virtual machine to be migrated" 151 | ], 152 | "correct": "b" 153 | }, 154 | { 155 | "question": "Why system level virtualization (a.k.a. Hypervisor) increase security?", 156 | "answers": [ 157 | "Because the hypervisor run in user mode ", 158 | "Because the hypervisor control and filters the execution of privileged instructions invoked by the guest operating system", 159 | "Because the guest operating systems cannot access the physical resources and then cannot do harmful operations", 160 | "Because the hypervisor run in privileged mode", 161 | "Because the guest operating system use hyper-call and hardware assisted virtualization" 162 | ], 163 | "correct": "b" 164 | }, 165 | { 166 | "question": "Consider the Kubernetes architecture in the figure. Assume you configure the container autoscaling mechanisms. What is the missing component in the figure?", 167 | "figure": "kubernetes", 168 | "answers": [ 169 | "A resource usage monitor module", 170 | "The pod module", 171 | "The planner module", 172 | "The analyzer module" 173 | ], 174 | "correct": "a" 175 | }, 176 | { 177 | "question": "Consider the Kubernetes architecture in the figure. What is the component that takes scaling decisions?", 178 | "figure": "kubernetes", 179 | "answers": [ 180 | "The kube-apiserver", 181 | "The kube-scheduler", 182 | "The kube-controller-manager", 183 | "The cloud-controller manager" 184 | ], 185 | "correct": "c" 186 | }, 187 | { 188 | "question": "Consider the Kubernetes architecture in the figure. What is the component that decides on which Kubernetes node to start a new container?", 189 | "figure": "kubernetes", 190 | "answers": [ 191 | "The kube-scheduler ", 192 | "The cloud-controller manager", 193 | "The kube-controller manager", 194 | "The kube-apiserver" 195 | ], 196 | "correct": "a" 197 | }, 198 | { 199 | "question": "Consider the MAPE-K cycle in the figure. What are the AWS components that implement the Monitor, Analysis and Plan phases?", 200 | "figure": "mapek", 201 | "answers": [ 202 | "Monitor=CloudWatch, Analysis=Alarms, Plan=Dynamic Scaling", 203 | "Monitor=CloudWatch, Analysis=Metrics, Plan=Dynamic Scaling ", 204 | "Monitor=CloudWatch, Analysis=CloudWatch, Plan=Elastic Load Balancer", 205 | "Monitor=Metrics, Analysis=Thresholds, Plan=Scale-in/out policy", 206 | "Monitor=Metrics, Analysis=Alarms, Plan=Thresholds" 207 | ], 208 | "correct": "a" 209 | }, 210 | { 211 | "question": "Consider the BigTable datastore architecture in the figure. Which among the followings are duties of the Tablet server?", 212 | "figure": "bigtable", 213 | "answers": [ 214 | "To split tablets that have grown too large; to assign tablets to tablet servers; to detect the addition and expiration of tablet servers", 215 | "To manage a set of tablets; to handle read and write requests to the tablets that it has loaded; to split tablets that have grown too large", 216 | "To balance tablet-server load, and garbage collection of files in GFS; to handle schema changes such as table and column family creations; to handle read and write requests" 217 | ], 218 | "correct": "b" 219 | }, 220 | { 221 | "question": "Consider the architecture of the HDFS in the figure. Which among the following actions are performed by the NameNode?", 222 | "figure": "hdfs", 223 | "answers": [ 224 | "To manages the File System Namespace; to controls access to files; to store metadata", 225 | "To manages the File System Namespace; to write in the journal log; to handle the communication with the data nodes", 226 | "To record changes in a log; to check DataNode liveness; to write in a file", 227 | "To write in a file; to manage the cryptographic keys; to handle the communication with the data nodes", 228 | "To write in a file; to write in the journal log; to restart/replace failing DataNode" 229 | ], 230 | "correct": "a" 231 | }, 232 | { 233 | "question": "Consider the Google File System architecture in the figure. What components (or component) are responsible to handle the file access?", 234 | "figure": "gfs", 235 | "answers": [ 236 | "Application and chunk server", 237 | "Application, master and chunk server", 238 | "Master and chunk server", 239 | "The linux file system" 240 | ], 241 | "correct": "a" 242 | }, 243 | { 244 | "question": "Researchers and engineers at Google designed the Google File System taking into account the file access model. What is the most frequent type of file access?", 245 | "answers": [ 246 | "Random write", 247 | "Random read", 248 | "Sequential read" 249 | ], 250 | "correct": "c" 251 | }, 252 | { 253 | "question": "Researchers and engineers at Google designed the Google File System taking into account the file access model. What is the most frequent type of file access?", 254 | "answers": [ 255 | "Random write", 256 | "Random read", 257 | "Append write" 258 | ], 259 | "correct": "c" 260 | }, 261 | { 262 | "question": "What among the following is an RDD transformation?", 263 | "answers": [ 264 | "collect", 265 | "reduce", 266 | "reduceByKey" 267 | ], 268 | "correct": "c" 269 | }, 270 | { 271 | "question": "What among the following is an RDD transformation?", 272 | "answers": [ 273 | "collect", 274 | "reduce", 275 | "map" 276 | ], 277 | "correct": "c" 278 | }, 279 | { 280 | "question": "What among the following is an RDD action?", 281 | "answers": [ 282 | "collect", 283 | "map", 284 | "reduceByKey" 285 | ], 286 | "correct": "a" 287 | }, 288 | { 289 | "question": "Hadoop MapReduce optimizes data locality when map tasks are deployed on the Hadoop cluster, that is Hadoop MapReduce try first to run Map tasks on a data local node to not use cluster bandwidth. In case local optimization is not possible, what alternative deployment policies are used?", 290 | "answers": [ 291 | "Rack local deployment", 292 | "Cluster local deployment", 293 | "Round-robin deployment" 294 | ], 295 | "correct": "a" 296 | }, 297 | { 298 | "question": "A MapReduce computation is usually executed on a large cluster of commodity nodes. Hence, the failure probability of the master and worker nodes is very high. In case the master node fails, what action should be taken to preserve the result of the computation?", 299 | "answers": [ 300 | "All the the reduce tasks need to be re-scheduled and executed also if some completed", 301 | "All the the map tasks need to be re-scheduled and executed also if some completed", 302 | "The entire MapReduce computation must be restarted" 303 | ], 304 | "correct": "c" 305 | }, 306 | { 307 | "question": "A MapReduce computation is usually executed on a large cluster of commodity nodes. Hence, the failure probability of the master and worker nodes is very high. In case a map worker node fail, what action should be taken to preserve the result of the computation?", 308 | "answers": [ 309 | "All the the reduce tasks need to be re-scheduled and executed also if some completed", 310 | "All the map tasks assigned to the worker will be re-scheduled and re-executed, also if some completed", 311 | "The entire MapReduce computation must be restarted" 312 | ], 313 | "correct": "b" 314 | }, 315 | { 316 | "question": "Which of the following is a cloud deployment model?", 317 | "answers": [ 318 | "Cloud Service Broker", 319 | "Public cloud", 320 | "Software as a Service" 321 | ], 322 | "correct": "b" 323 | }, 324 | { 325 | "question": "Which of the following is a cloud service model", 326 | "answers": [ 327 | "Private Cloud", 328 | "Docker as a Service", 329 | "Infrastructure as a Service" 330 | ], 331 | "correct": "c" 332 | }, 333 | { 334 | "question": "Consider the difference between SOA and microservices and specifically the communication mechanisms. What of the following assertion is correct?", 335 | "answers": [ 336 | "Both microservices and SOA use a message broker. SOA message broker is a proprietary technology, while the micrroservices message broker is open source", 337 | "Microservices uses lightweight and open-source communication mechanisms, while SOA uses heavyweight and often proprietary communication mechanisms.", 338 | "SOA uses lightweight communication mechanisms and microservices uses open source communication mechanisms" 339 | ], 340 | "correct": "b" 341 | }, 342 | { 343 | "question": "What are the enabling technologies for containers?", 344 | "answers": [ 345 | "Namespaces, cgroups, unionfs", 346 | "Docker, Kubernetes, Linux", 347 | "Namespace, access control groups, file union mechanisms" 348 | ], 349 | "correct": "a" 350 | }, 351 | { 352 | "question": "Assume that you are deploying a set of containers on different Docker hosts, and such containers need to communicate each other. Which network drivers will you use?", 353 | "answers": [ 354 | "User-defined bridge networks", 355 | "Overlay Networks", 356 | "Macvlan networks" 357 | ], 358 | "correct": "b" 359 | }, 360 | { 361 | "question": "Considering the write protocol of the HDFS. Who is in charge of sending the “write successful” acknowledgement to the NameNode?", 362 | "figure": "hdfs", 363 | "answers": [ 364 | "The primary DataNode and all the secondary DataNode involved in the write operation", 365 | "The client", 366 | "The primary DataNode involved in the write operation" 367 | ], 368 | "correct": "b" 369 | }, 370 | { 371 | "question": "A Bigtable is a sparse, distributed, persistent multidimensional sorted map. Which data could be accessed with the key (Row key, column key, timestamp)?", 372 | "answers": [ 373 | "A specific version of a big table cell", 374 | "A family cell", 375 | "All the cell with the same Row and Column key stored from the time=0 (creation of the table) to time=timestemp" 376 | ], 377 | "correct": "a" 378 | }, 379 | { 380 | "question": "What is a Cloud Broker?", 381 | "answers": [ 382 | "An entity that manages the use, performance and delivery of cloud services, and negotiates relationships between Cloud Providers and Cloud Consumers.", 383 | "An intermediary that provides connectivity and transport of cloud services from Cloud Providers to Cloud Consumers.", 384 | "A party that can conduct independent assessment of cloud services, information system operations, performance and security of the cloud implementation." 385 | ], 386 | "correct": "a" 387 | }, 388 | { 389 | "question": "What is Rapid Elasticity?", 390 | "answers": [ 391 | "Is the degree to which a system is able to add or remove virtual machines automatically, without any human in the loop", 392 | "Is the degree of workload changes and performance trend changes by provisioning and deprovisioning resources in an automatic manner", 393 | "Is the degree to which a system is able to adapt to workload changes by provisioning and deprovisioning resources in an automatic manner" 394 | ], 395 | "correct": "c" 396 | }, 397 | { 398 | "question": "What is a namespace?", 399 | "answers": [ 400 | "A namespace wraps a global system resource in an abstraction that makes it appear to the processes within the namespace that they have their own isolated instance of the global resource.", 401 | "A namespace is an abstraction that wraps containers running tightly coupled services. Namespaces are implemented as Pod in Kubernetes.", 402 | "A namespace is a Linux kernel feature which allow processes to be organized into groups whose usage of various types of resources can then be limited and monitored" 403 | ], 404 | "correct": "a" 405 | }, 406 | { 407 | "question": "Consider the docker CLI command `docker run -i -t ubuntu /bin/bash`, which of the following actions is performed by the command?", 408 | "answers": [ 409 | "Locate and eventually download the ubuntu image, if not locally stored", 410 | "Create two containers: the first one running Ubuntu OS and the second one running the bash application", 411 | "Run a temporary filesystem and the bash CLI on top of it." 412 | ], 413 | "correct": "a" 414 | }, 415 | { 416 | "question": "Consider the Google File System architecture. What is/are the component/s responsible to create a file?", 417 | "figure": "gfs", 418 | "answers": [ 419 | "Application and chunk server", 420 | "Master and chunk server", 421 | "Chunk Server", 422 | "The master", 423 | "The linux file system" 424 | ], 425 | "correct": "d" 426 | }, 427 | { 428 | "question": "Which of the following definition of capacity planning is correct?", 429 | "answers": [ 430 | "Capacity planning is a methodology that allows to determine the right amount of capacity when needed to avoid Over-provisioning and Under-provisioning of resources.", 431 | "Capacity planning is part of the elasticity essential characteristic of cloud computing enabling on demand self service.", 432 | "Capacity planning is a set of technologies enabling cloud computing scalability to avoid over provisioning and under provisioning." 433 | ], 434 | "correct": "a" 435 | }, 436 | { 437 | "question": "Which of the following are benefits of the microservice architecture?", 438 | "answers": [ 439 | "Simple to develop and easy to make radical changes of the whole application; Straightforward to test and deploy; Easy to scale", 440 | "Better fault isolation; Cost reduction; Open source technology; Lightweight execution environment", 441 | "Maintainability of the services; Independent deployability of services; Independent scalability of services" 442 | ], 443 | "correct": "c" 444 | }, 445 | { 446 | "question": "Which of the following are challenges in the microservice architecture?", 447 | "answers": [ 448 | "Experimenting and adoption of new technologies; fault isolation;", 449 | "Efficient resource management; orchestration; choreography", 450 | "Finding the right set of services; to develop, test and deploy complex applications" 451 | ], 452 | "correct": "c" 453 | }, 454 | { 455 | "question": "What is a microservice architecture?", 456 | "answers": [ 457 | "Is an architectural style that structures an application as a collection of services that are: Highly maintainable and testable;Loosely coupled; Independently deployable; Organized around business capabilities; Owned by a small team.", 458 | "Is an architectural style that structures an application as a collection of components having their own life cycles and interacting each other by means of communicating processes or event systems.", 459 | "Is an new architectural style merging the good of loosely coupled and Independently deployable event based systems in client server architecture" 460 | ], 461 | "correct": "a" 462 | }, 463 | { 464 | "question": "A Bigtable is a sparse, distributed, persistent multidimensional sorted map. Which of the following keys does not allow to locate a cell?", 465 | "answers": [ 466 | "Row key, column key and timestamp", 467 | "Row key, family key and timestamp", 468 | "Row key and column key" 469 | ], 470 | "correct": "b" 471 | }, 472 | { 473 | "question": "Bigtable uses timestamp to maintain versioning of the data stored. What among the followings is a mechanism to garbage collect cell versions automatically?", 474 | "answers": [ 475 | "Only new-enough versions be kept", 476 | "The last n versions that are new-enough be kept", 477 | "The last n versions modified in the last 7 days be kept" 478 | ], 479 | "correct": "a" 480 | }, 481 | { 482 | "question": "The NIST definition of Cloud computing mention that “Computing resources are pooled to serve multiple consumers using a multi-tenant model”. What does multi-tenancy means?", 483 | "answers": [ 484 | "Multiple users (tenants) access the same application logic simultaneously", 485 | "Multiple users (tenants) access the same virtual host simultaneously", 486 | "Multiple users (tenants) access the same data and configurations simultaneously" 487 | ], 488 | "correct": "a" 489 | }, 490 | { 491 | "question": "What is a capacity planning match strategy?", 492 | "answers": [ 493 | "A strategy for adding capacity when the IT resource reaches its full capacity", 494 | "A strategy for adding capacity to an IT resource in anticipation of demand", 495 | "A strategy for adding IT resource capacity in small increments, as demand increases" 496 | ], 497 | "correct": "c" 498 | }, 499 | { 500 | "question": "Assume you are using a service offered via a web application and you do not pay for the use of the service. Which feature the service should have to be classified as a cloud service?", 501 | "answers": [ 502 | "The service should provide the illusion of having infinite resources", 503 | "The service should be capable to scale in or out", 504 | "The service should allow to control security and privacy" 505 | ], 506 | "correct": "a" 507 | }, 508 | { 509 | "question": "The Ansible automation tools is defined to be an “agentless tool that runs in a push model”. What a push model means?", 510 | "answers": [ 511 | "It is required to install specific software component on the remote machines to make them receive instruction pushed by the Ansible server", 512 | "It manages remote machines by passing instructions (Ansible modules) to remote management framework already existing on the platforms to be administered", 513 | "The management tool does not create any overhead when administration tasks are not running" 514 | ], 515 | "correct": "b" 516 | }, 517 | { 518 | "question": "Suppose you have two implementation and deployment of the same application, one based on the Service Oriented Architecture and the other based on the Microservice Architecture. What will be the main difference between the two implementation and deployment?", 519 | "answers": [ 520 | "Scaling algorithms used; reusability of the services; level of coupling of the services", 521 | "Scaling algorithms used; data storage technologies; level of coupling of the services", 522 | "Communication mechanisms used; Data handling model adopted; and size of the services" 523 | ], 524 | "correct": "c" 525 | }, 526 | { 527 | "question": "An essential characteristic of cloud computing is measured service. How AWS implement this feature?", 528 | "answers": [ 529 | "With CloudWatch", 530 | "With EBS", 531 | "With autoscaling groups" 532 | ], 533 | "correct": "a" 534 | }, 535 | { 536 | "question": "What is the difference between Horizontal duplication and Functional decomposition in microservices?", 537 | "answers": [ 538 | "Horizontal duplication is about scaling horizontally by replicating the whole application. Functional decomposition is about organising the application in functionalities that could be scaled individually according to the function's workload", 539 | "Horizontal duplication is about replicating the whole application to improve availability. Functional decomposition is about partitioning the workload among replicas of the same function", 540 | "Horizontal duplication is about scaling horizontally. Functional decomposition is about to replicate a functionality and to assign a different data partition to each replica" 541 | ], 542 | "correct": "a" 543 | }, 544 | { 545 | "question": "The microservices architecture is defined as “an architectural style that structures an application as a collection of services that are: highly maintainable and testable; loosely coupled; Independently deployable; organized around business capabilities; owned by a small team.” Why services should be loosely coupled?", 546 | "answers": [ 547 | "To facilitate the use of third party services", 548 | "To facilitate interoperability", 549 | "To minimize dependencies" 550 | ], 551 | "correct": "c" 552 | }, 553 | { 554 | "question": "Let us consider an independent components event based system. What a subscriber component should provide?", 555 | "answers": [ 556 | "A callback function that will be executed to generate events", 557 | "An application programming interface to query for a specifi event", 558 | "A callback function that will be executed when the event is activated" 559 | ], 560 | "correct": "c" 561 | }, 562 | { 563 | "question": "Linux Namespace is an enabling technology for containers. What is exactly a Namespace?", 564 | "answers": [ 565 | "A namespace is a Linux kernel feature that allow to identify a set of local resource belonging (visible) to the processes within the namespace", 566 | "A namespace is a Linux kernel feature which wraps a global system resource in an abstraction and allow to limit and monitor the usage of varius type of resources", 567 | "A namespace wraps a global system resource in an abstraction that makes it appear to the processes within the namespace that they have their own isolated instance of the global resource" 568 | ], 569 | "correct": "c" 570 | }, 571 | { 572 | "question": "Consider the docker CLI command `docker run -dp 3000:3000 getting-started`, which of the following actions is performed by the command?", 573 | "answers": [ 574 | "Run and duplicate the getting-started container (-d) and create a mapping between the host's port 3000 to the container's port 3000 (-p)", 575 | "Run and duplicate the getting-started container (-d) and create a mapping between the ports 3000 of the two containers (-p)", 576 | "Run the getting-started container in the background (-d) and create a mapping between the host's port 3000 to the container's port 3000 (-p)" 577 | ], 578 | "correct": "c" 579 | }, 580 | { 581 | "question": "A Bigtable is a sparse, distributed, persistent multidimensional sorted map. Which are the keys needed to locate a desired cell's version?", 582 | "answers": [ 583 | "Row key, column key and timestamp", 584 | "Row key, family key and timestamp", 585 | "Only a row key", 586 | "Row key and column key" 587 | ], 588 | "correct": "a" 589 | }, 590 | { 591 | "question": "A Bigtable uses timestamp to maintain versioning of the data stored. What of the followings is a mechanism to garbage collect cell versions automatically?", 592 | "answers": [ 593 | "Only the last n versions of a cell be kept", 594 | "Only last 3 versions of a cell be kept", 595 | "Only the last 7 days versions be kept", 596 | "Maximum the last n versions that are new-enough versions be kept" 597 | ], 598 | "correct": "a" 599 | }, 600 | { 601 | "question": "Researchers and engineers at Google designed the Google File System taking into account the file characteristics. What is the typical range for file size?", 602 | "answers": [ 603 | "Hundreds of Megabyte to few Terabytes", 604 | "Few Megabyte to hundreds of Gigabytes", 605 | "Kilobyte to few Gigabytes", 606 | "Few Gigabyte to hundreds of Terabytes" 607 | ], 608 | "correct": "d" 609 | }, 610 | { 611 | "question": "What is the chunk size in the Google File System?", 612 | "answers": [ 613 | "64 MegaByte", 614 | "128 MegaByte", 615 | "1 GigaByte", 616 | "Configurable from 64 Megabyte to 128 Megabyte" 617 | ], 618 | "correct": "a" 619 | }, 620 | { 621 | "question": "Consider the architecture of the HDFS in the figure. Which are the main responsibilities of the NameNode?", 622 | "figure": "hdfs", 623 | "answers": [ 624 | "Manages the File System Namespace; store metadata; check DataNode liveness", 625 | "To write in a file; store metadata; check DataNode liveness", 626 | "To manage the cryptographic keys; manages the File System Namespace; check datanode liveness", 627 | "To handle the communication with the data nodes; manages the File System Namespace; store metadata" 628 | ], 629 | "correct": "a" 630 | }, 631 | { 632 | "question": "Consider the Big Table datastore in the figure. Which among the followings are responsibility of the Master node?", 633 | "figure": "bigtable", 634 | "answers": [ 635 | "To assign tablets to tablet servers; to detect the addition and expiration of tablet servers; to balance tablet-server load, and garbage collection of files in GFS", 636 | "To handle read and write requests to the tablet servers; to assign tablets to tablet server; to detect the addition and expiration of tablet servers", 637 | "To identify tablet that have grown too large and that need to be split; to balance tablet-server load and garbage collection of files in GFS; to assign tablets to tablet servers", 638 | "To manage the tables in the tablet servers; to detect the addition and expiration of tablet servers; to balance tablet-server load, and garbage collection of files in GFS" 639 | ], 640 | "correct": "a" 641 | }, 642 | { 643 | "question": "A Bigtable is a sparse, distributed, persistent multidimensional sorted map. Which are the keys needed to locate a desired cell?", 644 | "answers": [ 645 | "Row key, column key and timestamp", 646 | "Row key, family key and timestamp", 647 | "Only a row key", 648 | "Row key and column key" 649 | ], 650 | "correct": "d" 651 | }, 652 | { 653 | "question": "Consider the docker CLI command `docker build -t getting-started` which of the following actions is performed by the command?", 654 | "answers": [ 655 | "Build a container processing a Dockerfile stored in the current working directory and tag the new container with the name getting-started", 656 | "Build a container processing a Dockerfile named getting-started", 657 | "Build a container processing a Dockerfile named getting-started and store it in the current working directory rather then uploading it in the docker registry" 658 | ], 659 | "correct": "a" 660 | }, 661 | { 662 | "question": "How data are typically handled in a microservice architecture?", 663 | "answers": [ 664 | "Services are stateless, and then do not maintain any data model", 665 | "Each service has its own database and data model", 666 | "Services share a global data model and a databases" 667 | ], 668 | "correct": "b" 669 | }, 670 | { 671 | "question": "Which of the following is a challenges in the microservice architecture?", 672 | "answers": [ 673 | "Experimenting and adoption of new technologies;", 674 | "Fault isolation", 675 | "Deploying features that span multiple services developed by different teams" 676 | ], 677 | "correct": "c" 678 | }, 679 | { 680 | "question": "Which of the following is a key difference between microservices and SOA?", 681 | "answers": [ 682 | "Programming languages", 683 | "Data security", 684 | "Data handling" 685 | ], 686 | "correct": "c" 687 | }, 688 | { 689 | "question": "Which of the following is a benefit of microservice architecture?", 690 | "answers": [ 691 | "The microservice architecture enables fault propagation", 692 | "The microservice architecture enable small and easily maintained services.", 693 | "The microservice architecture enables intensive collaboration among teams" 694 | ], 695 | "correct": "b" 696 | }, 697 | { 698 | "question": "_____________ is a global description of the participating services, which is defined by the exchange of", 699 | "answers": [ 700 | "Service choreography", 701 | "Service orchestration", 702 | "Service automation" 703 | ], 704 | "correct": "a" 705 | }, 706 | { 707 | "question": "Suppose you want to add a new record in a database using a REST web service. Are the following HTTP requests equivalent?", 708 | "figure": "post", 709 | "answers": [ 710 | "YES;", 711 | "NO" 712 | ], 713 | "correct": "a" 714 | }, 715 | { 716 | "question": "Suppose you must store the container's data on a remote host or a cloud provider rather than locally. Which Docker storage option is the most appropriate?", 717 | "answers": [ 718 | "Tmpfs mount;", 719 | "Bind mount", 720 | "Volumes" 721 | ], 722 | "correct": "c" 723 | }, 724 | { 725 | "question": "Assume you are setting up a scalable web server with AWS and configuring a step scaling policy for your autoscaling group. You have set the alarm to start the scale-out with a threshold on the average value of the incoming traffic. Which of the following assertions is true?", 726 | "answers": [ 727 | "The alarm occurs if, for the majority of the instances in the scaling group, the value of the incoming traffic exceeds the threshold (e.g. for 3 out of 5).", 728 | "The alarm occurs if there is at least an instance in the scaling group with the value of the incoming traffic exceeding the threshold.", 729 | "The alarm occurs if the average value of the incoming traffic computed over all the instances in the scaling group exceed the threshold." 730 | ], 731 | "correct": "c" 732 | }, 733 | { 734 | "question": "Consider the Kubernetes architecture in the figure. Assume you configure the pod autoscaling mechanisms. What is the missing component in the figure?", 735 | "figure": "kubernetes", 736 | "answers": [ 737 | "The planner module", 738 | "The analyzer module", 739 | "A resource usage monitor module" 740 | ], 741 | "correct": "c" 742 | }, 743 | { 744 | "question": "An autoscaling algorithm is considered proactive when the number of needed resources is computed using an ML or mathematical model.", 745 | "answers": [ 746 | "TRUE", 747 | "FALSE" 748 | ], 749 | "correct": "b" 750 | }, 751 | { 752 | "question": "___________________ is the ability to constant monitoring for optimal operation", 753 | "answers": [ 754 | "Self-optimization", 755 | "Self-healing", 756 | "Self-configuration" 757 | ], 758 | "correct": "a" 759 | }, 760 | { 761 | "question": "Who is responsible for the Security IN the cloud?", 762 | "answers": [ 763 | "The Cloud Service Provider", 764 | "The Customer" 765 | ], 766 | "correct": "b" 767 | }, 768 | { 769 | "question": "Consider you want to set up an Elastic Load Balancer for supporting HTTPS requests. Which type of ELB will you select?", 770 | "answers": [ 771 | "Network load balancer", 772 | "Application Load Balancer", 773 | "Classic Load Balancer" 774 | ], 775 | "correct": "b" 776 | }, 777 | { 778 | "question": "Data replication across Regions is controlled by ______________", 779 | "answers": [ 780 | "AWS", 781 | "Customer" 782 | ], 783 | "correct": "b" 784 | }, 785 | { 786 | "question": "When will the public IPv4 address and external DNS hostname of an AWS EC2 instance change?", 787 | "answers": [ 788 | "When an instance is launched", 789 | "When an instance is stopped and then started again", 790 | "When an instance is rebooted" 791 | ], 792 | "correct": "b" 793 | }, 794 | { 795 | "question": "Why scalability is related to performance in a cloud system?", 796 | "answers": [ 797 | "Scalability measure how fast and efficiently a system can complete certain task", 798 | "Scalability measure how fast is an elasticity mechanism in provisioning or deprovisioning resources", 799 | "Scalability measure the trend of performance with increasing load" 800 | ], 801 | "correct": "c" 802 | }, 803 | { 804 | "question": "Which type of scalability is facilitated by microservices", 805 | "answers": [ 806 | "Scale by cloning", 807 | "Single functions scalability", 808 | "Scaling of Application data" 809 | ], 810 | "correct": "b" 811 | }, 812 | { 813 | "question": "Which of the following is a benefit of microservice architecture?", 814 | "answers": [ 815 | "The microservice architecture increases the complexity of service maintenance", 816 | "The microservice architecture enables intensive collaboration among teams", 817 | "The microservice architecture enables fault isolation" 818 | ], 819 | "correct": "c" 820 | }, 821 | { 822 | "question": "Suppose you must back up, restore, or migrate data from one Docker host to another. Which Docker storage option is the most appropriate?", 823 | "answers": [ 824 | "Tmpfs mount", 825 | "Volumes", 826 | "Bind mount" 827 | ], 828 | "correct": "b" 829 | }, 830 | { 831 | "question": "___________________ is the ability to constant monitoring for optimal operation", 832 | "answers": [ 833 | "Self-optimization", 834 | "Self-healing", 835 | "Self-configuration" 836 | ], 837 | "correct": "a" 838 | }, 839 | { 840 | "question": "Suppose you want to add a new record in a database using a REST web service. Are the following HTTP requests equivalent?", 841 | "figure": "put", 842 | "answers": [ 843 | "YES;", 844 | "NO" 845 | ], 846 | "correct": "b" 847 | }, 848 | { 849 | "question": "How can be classified a cloud mechanism that guarantees a given number of VMs or containers are always available (up & running)?", 850 | "answers": [ 851 | "Self-protecting mechanism", 852 | "Self-optimization mechanism", 853 | "Self-healing mechanism" 854 | ], 855 | "correct": "c" 856 | }, 857 | { 858 | "question": "An AWS Region typically consists of two or more ___________________.", 859 | "answers": [ 860 | "Storage replicas", 861 | "Availability Zones", 862 | "Datacenters" 863 | ], 864 | "correct": "b" 865 | }, 866 | { 867 | "question": "Who is responsible for the Security OF the cloud?", 868 | "answers": [ 869 | "The Cloud Service Provider", 870 | "The Customer" 871 | ], 872 | "correct": "a" 873 | }, 874 | { 875 | "question": "Which of the following is a benefit of microservice architecture?", 876 | "answers": [ 877 | "The microservice architecture allows easy experimenting and adoption of new technologies", 878 | "The microservice architecture enables intensive collaboration among teams", 879 | "The microservice architecture enables fault propagation" 880 | ], 881 | "correct": "a" 882 | }, 883 | { 884 | "question": "Suppose you must share configuration files from the host machine to containers . Which Docker storage option is the most appropriate?", 885 | "answers": [ 886 | "Tmpfs mount", 887 | "Volumes", 888 | "Bind mount" 889 | ], 890 | "correct": "c" 891 | }, 892 | { 893 | "question": "Consider setting up an Elastic Load Balancer to support traffic to a containerized application. Which type of ELB will you select?", 894 | "answers": [ 895 | "Application Load Balancer", 896 | "Network load balancer", 897 | "Classic Load Balancer" 898 | ], 899 | "correct": "a" 900 | }, 901 | { 902 | "question": "Consider setting up an Elastic Load Balancer for supporting a static or Elastic IP address, or an IP target outside a VPC. Which type of ELB will you select?", 903 | "answers": [ 904 | "Network load balancer", 905 | "Application Load Balancer", 906 | "Classic Load Balancer" 907 | ], 908 | "correct": "a" 909 | }, 910 | { 911 | "question": "Each ___________________ is a fully isolated partition of the AWS infrastructure.", 912 | "answers": [ 913 | "Datacenter", 914 | "Availability Zone", 915 | "Region" 916 | ], 917 | "correct": "b" 918 | }, 919 | { 920 | "question": "Which of the following is a challenges in the microservice architecture?", 921 | "answers": [ 922 | "Experimenting and adoption of new technologies;", 923 | "Fault isolation", 924 | "Development, testing and deployment is challenging" 925 | ], 926 | "correct": "c" 927 | }, 928 | { 929 | "question": "Suppose you must share source code or build artifacts between a development environment on the Docker host and a container. Which Docker storage option is most appropriate?", 930 | "answers": [ 931 | "Tmpfs mount", 932 | "Volumes", 933 | "Bind mount" 934 | ], 935 | "correct": "c" 936 | }, 937 | { 938 | "question": "An autoscaling algorithm is considered proactive when the scaling decision is taken on the basis of a predicted value of the scaling metrics. E.g. predicted value of CPU utilization in the next 5 minutes.", 939 | "answers": [ 940 | "TRUE", 941 | "FALSE" 942 | ], 943 | "correct": "a" 944 | }, 945 | { 946 | "question": "Each AWS Region provides ____________________ and connectivity to the network.", 947 | "answers": [ 948 | "high availability ", 949 | "traffic load balancing", 950 | "full redundancy" 951 | ], 952 | "correct": "c" 953 | }, 954 | { 955 | "question": "Which among the following is the appropriate definition for capacity planning", 956 | "answers": [ 957 | "Methods, models and algorithms to provide the right amount of capacity when needed", 958 | "Methods models and algorithms for adding capacity to an IT resource in anticipation of demand KO", 959 | "Methods. models and algorithms to scale up/down or in/out" 960 | ], 961 | "correct": "a" 962 | }, 963 | { 964 | "question": "Which of the following is a key difference between microservices and SOA?", 965 | "answers": [ 966 | "Communication mechanisms", 967 | "Programming languages", 968 | "Data security" 969 | ], 970 | "correct": "a" 971 | }, 972 | { 973 | "question": "_____________ represents a single centralized executable business process that coordinates the interaction among different services.", 974 | "answers": [ 975 | "Service automation", 976 | "Service choreography", 977 | "Service orchestration" 978 | ], 979 | "correct": "c" 980 | }, 981 | { 982 | "question": "___________________ is the ability to accommodate varying and possibly unpredictable conditions.", 983 | "answers": [ 984 | "Self-healing", 985 | "Self-configuration", 986 | "Self-optimization" 987 | ], 988 | "correct": "b" 989 | }, 990 | { 991 | "question": "Which of the following is a benefit of microservice architecture?", 992 | "answers": [ 993 | "The microservice architecture enables fault propagation", 994 | "The microservice architecture limits adoption of new technologies", 995 | "The microservice architecture enables teams to be autonomous." 996 | ], 997 | "correct": "c" 998 | }, 999 | { 1000 | "question": "Consider setting up an Elastic Load Balancer for handling extremely spiky and unpredictable TCP traffic. Which type of ELB will you select?", 1001 | "answers": [ 1002 | "Classic Load Balancer", 1003 | "Application Load Balancer", 1004 | "Network load balancer" 1005 | ], 1006 | "correct": "c" 1007 | }, 1008 | { 1009 | "question": "Which of the following is a challenges in the microservice architecture?", 1010 | "answers": [ 1011 | "Fault isolation", 1012 | "Finding the right set of services", 1013 | "Experimenting and adoption of new technologies;" 1014 | ], 1015 | "correct": "b" 1016 | }, 1017 | { 1018 | "question": "Assume you are setting up a scalable web server with AWS and configuring a step scaling policy for your autoscaling group. You have set the alarm to start the scale-out with a threshold on the maximum incoming traffic. Which of the following assertions is true?", 1019 | "answers": [ 1020 | "The alarm occurs if for all the instances in the scaling group the value of the incoming traffic exceeds the threshold.", 1021 | "The alarm occurs if the average value of the incoming traffic computed over all the instances in the scaling group exceed the threshold.", 1022 | "The alarm occurs if for at least one instance the maximum observed incoming traffic exceeds the threshold." 1023 | ], 1024 | "correct": "c" 1025 | } 1026 | ] 1027 | -------------------------------------------------------------------------------- /json/2022_FDS.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "question": "What class does the Naive Bayes classifier predict for a given observation?", 4 | "answers": [ 5 | "The class maximizing the joint predictors probability", 6 | "The class minimizing the joint predictors probability", 7 | "The class maximizing the joint predictors/labels probability", 8 | "The class minimizing the joint predictors/labels probability" 9 | ], 10 | "correct": "C", 11 | "answer_have_code": "0", 12 | "code": "", 13 | "img": "", 14 | "answer_explanation": "" 15 | }, 16 | { 17 | "question": "If your dataset has two variables \ud835\udc99, \ud835\udc99\u2032 such that \ud835\udc99 = \ud835\udc82 \u22c5 \ud835\udc99\u2032 for some constant a > 0, then you have:", 18 | "answers": [ 19 | "overfitting", 20 | "underfitting", 21 | "multicollinearity", 22 | "supercollinearity" 23 | ], 24 | "correct": "C", 25 | "answer_have_code": "0", 26 | "code": "", 27 | "img": "", 28 | "answer_explanation": "" 29 | }, 30 | { 31 | "question": "A na\u00efve Bayes classifier can deal with previously unseen feature-label combination through:", 32 | "answers": [ 33 | "Laplacian smoothing", 34 | "Bootstrapping", 35 | "Stratified cross-validation", 36 | "Repeated sampling" 37 | ], 38 | "correct": "A", 39 | "answer_have_code": "0", 40 | "code": "", 41 | "img": "", 42 | "answer_explanation": "" 43 | }, 44 | { 45 | "question": "For a linear regression model, the expected squared error can be decomposed in:", 46 | "answers": [ 47 | "Variance and covariance", 48 | "SSE and SST", 49 | "Underfit and overfit", 50 | "Bias and variance noise" 51 | ], 52 | "correct": "D", 53 | "answer_have_code": "0", 54 | "code": "", 55 | "img": "", 56 | "answer_explanation": "" 57 | }, 58 | { 59 | "question": " What is the key assumption of the Na\u00efve Bayes Classifier?", 60 | "answers": [ 61 | "The predictors and labels are independent", 62 | "Each predictor follows a Gaussian distribution", 63 | "The predictors are independent conditionally on the label", 64 | "The number of predictors is at most poly(n)" 65 | ], 66 | "correct": "C", 67 | "answer_have_code": "0", 68 | "code": "", 69 | "img": "", 70 | "answer_explanation": "" 71 | }, 72 | { 73 | "question": "Which one of the following performance indicates the best model for prediction?", 74 | "answers": [ 75 | "\ud835\udc45' = 0.2 on training, \ud835\udc45' = 0.1 on test", 76 | "\ud835\udc45' = 0.7 on training, \ud835\udc45' = 0.7 on test", 77 | "\ud835\udc45' = 0.8 on training, \ud835\udc45' = 0.1 on test", 78 | "\ud835\udc45' = 0.9 on training, \ud835\udc45' = \u22120.9 on test" 79 | ], 80 | "correct": "B", 81 | "answer_have_code": "0", 82 | "code": "", 83 | "img": "", 84 | "answer_explanation": "" 85 | }, 86 | { 87 | "question": "You want to predict the market price of a team\u2019s merchandising (t-shirts, hats..), according to the team\u2019s seasonal performance. You suggest using:", 88 | "answers": [ 89 | "Linear regression", 90 | "Logistic regression", 91 | "Linear programming", 92 | "Clustering" 93 | ], 94 | "correct": "A", 95 | "answer_have_code": "0", 96 | "code": "", 97 | "img": "", 98 | "answer_explanation": "" 99 | }, 100 | { 101 | "question": "When is the accuracy a misleading classifier performance measure?", 102 | "answers": [ 103 | "When the population label proportions are unbalanced", 104 | "When the population label proportions are balanced", 105 | "When the sensitivity is high", 106 | "When the specificity is low" 107 | ], 108 | "correct": "A", 109 | "answer_have_code": "0", 110 | "code": "", 111 | "img": "", 112 | "answer_explanation": "" 113 | }, 114 | { 115 | "question": "The goal of linear regression is to?", 116 | "answers": [ 117 | "Make America great again", 118 | "Group similar observations together", 119 | "Learn a linear function from data", 120 | "Evaluate the amount of noise in the data" 121 | ], 122 | "correct": "C", 123 | "answer_have_code": "0", 124 | "code": "", 125 | "img": "", 126 | "answer_explanation": "" 127 | }, 128 | { 129 | "question": "In the bias-variance decomposition of the expected squared error, what does high bias suggest?", 130 | "answers": [ 131 | "Noisy data", 132 | "Overfitting", 133 | "Underfitting", 134 | "Crossfitting" 135 | ], 136 | "correct": "C", 137 | "answer_have_code": "0", 138 | "code": "", 139 | "img": "", 140 | "answer_explanation": "" 141 | }, 142 | { 143 | "question": "Social network users often form communities according to their tastes. If you had access to their personal data, you may verify this intuition by:", 144 | "answers": [ 145 | "Linear Regression", 146 | "Logistic Regression", 147 | "Clustering", 148 | "Linear programming" 149 | ], 150 | "correct": "C", 151 | "answer_have_code": "0", 152 | "code": "", 153 | "img": "", 154 | "answer_explanation": "" 155 | }, 156 | { 157 | "question": "R^2 is a measure of:", 158 | "answers": [ 159 | "Reliability of predictions", 160 | "Goodness of fit", 161 | "Significance of estimates", 162 | "Model complexity" 163 | ], 164 | "correct": "B", 165 | "answer_have_code": "0", 166 | "code": "", 167 | "img": "", 168 | "answer_explanation": "" 169 | }, 170 | { 171 | "question": "A company wants to relate the monthly revenue to productivity parameters such as total number of working hours, etc. They could use:", 172 | "answers": [ 173 | "Linear regression", 174 | "Logistic regression", 175 | "Clustering", 176 | "Linear programming" 177 | ], 178 | "correct": "A", 179 | "answer_have_code": "0", 180 | "code": "", 181 | "img": "", 182 | "answer_explanation": "" 183 | }, 184 | { 185 | "question": "How do you perform a linear regression in R?", 186 | "answers": [ 187 | "lm(y ~ x, data)", 188 | "lm(y ~ x, data, family = \u201cbinomial\u201d)", 189 | "predict(y ~ x, data)", 190 | "predict(y ~ x, data, binomial)" 191 | ], 192 | "correct": "A", 193 | "answer_have_code": "0", 194 | "code": "", 195 | "img": "", 196 | "answer_explanation": "" 197 | }, 198 | { 199 | "question": "Your friend proposes to cluster 300 observations by trying all possible clustering and taking the one that minimizes intra cluster variance. You observe that:", 200 | "answers": [ 201 | "This is the only possible approach", 202 | "This does not produce a good clustering", 203 | "This does require a few seconds", 204 | "This does require a centuries" 205 | ], 206 | "correct": "D", 207 | "answer_have_code": "0", 208 | "code": "", 209 | "img": "", 210 | "answer_explanation": "" 211 | }, 212 | { 213 | "question": "Single-linkage clustering works by", 214 | "answers": [ 215 | "Repeatedly recomputing the centroids of clusters", 216 | "Repeatedly merging smaller clusters into larger ones", 217 | "Enumerating all possible clustering of the given points", 218 | "Enumerating all possible points in a cluster" 219 | ], 220 | "correct": "B", 221 | "answer_have_code": "0", 222 | "code": "", 223 | "img": "", 224 | "answer_explanation": "" 225 | }, 226 | { 227 | "question": "In linear regression, a high value of \ud835\udc79\ud835\udfd0 on the training set suggests:", 228 | "answers": [ 229 | "A small error of the model on the fitted data", 230 | "A small error of the model on future predictions", 231 | "A large error of the model on the fitted data", 232 | "A large error of the model on future predictions" 233 | ], 234 | "correct": "A", 235 | "answer_have_code": "0", 236 | "code": "", 237 | "img": "", 238 | "answer_explanation": "" 239 | }, 240 | { 241 | "question": "A logistic regression gives the following scores, preceded by the actual label: (Y, 0.85), (Y, 0.75), (N,0.6), (Y,0.5), (N, 0.4), (N, 0.2). For a sensitivity of at least 2/3, the best choice is to predict Y when the score is at least:", 242 | "answers": [ 243 | "0.9", 244 | "0.75", 245 | "0.6", 246 | "0.45" 247 | ], 248 | "correct": "B", 249 | "answer_have_code": "0", 250 | "code": "", 251 | "img": "", 252 | "answer_explanation": "" 253 | }, 254 | { 255 | "question": "Look at the confusion matrix below. What we can say?", 256 | "answers": [ 257 | "The sensitivity is < 0.80%", 258 | "There are less positives than negatives", 259 | "The accuracy is > 90%", 260 | "The classifier predicts 1 on 60% of the times" 261 | ], 262 | "correct": "D", 263 | "answer_have_code": "0", 264 | "code": "", 265 | "img": "FDS/matrixwhatcanwesay.png", 266 | "answer_explanation": "" 267 | }, 268 | { 269 | "question": "A set of observations (\ud835\udc99\ud835\udfcf, \ud835\udc9a\ud835\udfcf), (\ud835\udc99\ud835\udfd0,\ud835\udc9a\ud835\udfd0)\u2026(\ud835\udc99\ud835\udc8f, \ud835\udc9a\ud835\udc8f) obeys the law \ud835\udc9a\ud835\udc8a \u2254 \ud835\udc82\ud835\udc99\ud835\udc8a + \ud835\udc83 + \ud835\udf3a\ud835\udc8a, where \ud835\udf3a\ud835\udc8a is some random noise. The task of estimating a and b from the dataset is called:", 270 | "answers": [ 271 | "Logistic regression", 272 | "Linear regression", 273 | "Linear programming", 274 | "Logistic programming" 275 | ], 276 | "correct": "B", 277 | "answer_have_code": "0", 278 | "code": "", 279 | "img": "", 280 | "answer_explanation": "" 281 | }, 282 | { 283 | "question": "Laplacian smoothing aims at:", 284 | "answers": [ 285 | "Producing readable plots by using an average window", 286 | "Reducing the model\u2019s dependence on the noise", 287 | "Improving the feature quality by removing outliers", 288 | "Avoid penalizing previously unseen observations" 289 | ], 290 | "correct": "D", 291 | "answer_have_code": "0", 292 | "code": "", 293 | "img": "", 294 | "answer_explanation": "" 295 | }, 296 | { 297 | "question": "A dataset of points (\ud835\udc99\ud835\udfcf, \ud835\udc9a\ud835\udfcf), (\ud835\udc99\ud835\udfd0,\ud835\udc9a\ud835\udfd0)\u2026(\ud835\udc99\ud835\udc8f, \ud835\udc9a\ud835\udc8f) has been generated by the model \ud835\udc9a\ud835\udc8a \u2254 \ud835\udc82\ud835\udc99\ud835\udc8a + \ud835\udc83 + \ud835\udf3a\ud835\udc8a, where \ud835\udf3a\ud835\udc8a is gaussian noise. Linear regression aims at estimating:", 298 | "answers": [ 299 | "a and b", 300 | "a and \ud835\udf00", 301 | "x and b", 302 | "x and y" 303 | ], 304 | "correct": "A", 305 | "answer_have_code": "0", 306 | "code": "", 307 | "img": "", 308 | "answer_explanation": "" 309 | }, 310 | { 311 | "question": "Which one of the following R commands selects only the rows of data where X equals 0?", 312 | "answers": [ 313 | "select(data, X == 0)", 314 | "filter(data, X==0)", 315 | "summarize(data, X==0)", 316 | "table(data, X == 0)" 317 | ], 318 | "correct": "B", 319 | "answer_have_code": "0", 320 | "code": "", 321 | "img": "", 322 | "answer_explanation": "" 323 | }, 324 | { 325 | "question": "If an algorithm has exponential complexity, then we can assume that:", 326 | "answers": [ 327 | "In practice it is still fast enough to be useful", 328 | "It admits a polynomial-time algorithm", 329 | "It can be solved by finding an optimal clustering", 330 | "No technological progress will ever make it practical" 331 | ], 332 | "correct": "D", 333 | "answer_have_code": "0", 334 | "code": "", 335 | "img": "", 336 | "answer_explanation": "" 337 | }, 338 | { 339 | "question": "If you have n points, what is the number of clusters that minimizes the within-cluster sum of square?", 340 | "answers": [ 341 | "1", 342 | "k", 343 | "n", 344 | "We cannot say" 345 | ], 346 | "correct": "C", 347 | "answer_have_code": "0", 348 | "code": "", 349 | "img": "", 350 | "answer_explanation": "" 351 | }, 352 | { 353 | "question": "Which regression model has smaller squared error in fitting a real function \ud835\udc87(\ud835\udc99)?", 354 | "answers": [ 355 | "A simple linear regression", 356 | "A logistic regression", 357 | "A polynomial regression of degree 2", 358 | "A polynomial regression of degree 10" 359 | ], 360 | "correct": "A", 361 | "answer_have_code": "0", 362 | "code": "", 363 | "img": "", 364 | "answer_explanation": "" 365 | }, 366 | { 367 | "question": "A doping screening is tested on a pool of 800 athletes of which 796 are clean. The test is correct in 99% of the cases. What can we say about it?", 368 | "answers": [ 369 | "It may have missed all of the doped athletes", 370 | "It may have missed all of the clean athletes", 371 | "It identified all of the doped athletes", 372 | "It identified all of the clean atheletes" 373 | ], 374 | "correct": "A", 375 | "answer_have_code": "0", 376 | "code": "", 377 | "img": "", 378 | "answer_explanation": "" 379 | }, 380 | { 381 | "question": "In linear programming, the space of feasible solution is:", 382 | "answers": [ 383 | "An arbitrary set", 384 | "A subset of \ud835\udc45'", 385 | "A convex polytope", 386 | "None of the above" 387 | ], 388 | "correct": "C", 389 | "answer_have_code": "0", 390 | "code": "", 391 | "img": "", 392 | "answer_explanation": "" 393 | }, 394 | { 395 | "question": "The explained variance of a clustering equals:", 396 | "answers": [ 397 | "Within-cluster SSE divided by total sum of squares", 398 | "Total sum of squares divided by within-cluster SSE", 399 | "Within-cluster SSE divided by between-cluster SSE", 400 | "Total sum of squares divided by between-cluster SSE" 401 | ], 402 | "correct": "A", 403 | "answer_have_code": "0", 404 | "code": "", 405 | "img": "", 406 | "answer_explanation": "" 407 | }, 408 | { 409 | "question": "Gradient descent is a technique we have used to:", 410 | "answers": [ 411 | "Compute the optimal number of clusters", 412 | "Reduce the noise in the training set", 413 | "Find the local minima of a function", 414 | "Estimate the probability of false positive" 415 | ], 416 | "correct": "C", 417 | "answer_have_code": "0", 418 | "code": "", 419 | "img": "", 420 | "answer_explanation": "" 421 | }, 422 | { 423 | "question": "Which of these models is probably overfitting?", 424 | "answers": [ 425 | "\ud835\udc45' = 0.1 on training, \ud835\udc45' = 0.1 on test", 426 | "\ud835\udc45' = 0.8 on training, \ud835\udc45' = 0.7 on test", 427 | "\ud835\udc45' = 0.7 on training, \ud835\udc45' = 0.7 on test", 428 | "\ud835\udc45' = 0.8 on training, \ud835\udc45' = 0.1 on test" 429 | ], 430 | "correct": "D", 431 | "answer_have_code": "0", 432 | "code": "", 433 | "img": "", 434 | "answer_explanation": "" 435 | }, 436 | { 437 | "question": "Laplacian smoothing aims at:", 438 | "answers": [ 439 | "Improving the feature quality by removing outliers", 440 | "Producing readable plots", 441 | "Reducing the model\u2019s dependence on the noise", 442 | "Avoid penalizing previously unseen observations" 443 | ], 444 | "correct": "C", 445 | "answer_have_code": "0", 446 | "code": "", 447 | "img": "", 448 | "answer_explanation": "" 449 | }, 450 | { 451 | "question": "To visualize a hierarchical clustering one can use:", 452 | "answers": [ 453 | "a dendrogram ", 454 | "a ROC curve", 455 | "a boxplot", 456 | "a histogram" 457 | ], 458 | "correct": "A", 459 | "answer_have_code": "0", 460 | "code": "", 461 | "img": "", 462 | "answer_explanation": "" 463 | }, 464 | { 465 | "question": "The goal of linear regression is to:", 466 | "answers": [ 467 | "bring peace to the world", 468 | "group similar observations together", 469 | "learn a linear function from data ", 470 | "evaluate the amount of noise in the data" 471 | ], 472 | "correct": "C", 473 | "answer_have_code": "0", 474 | "code": "", 475 | "img": "", 476 | "answer_explanation": "" 477 | }, 478 | { 479 | "question": "Naive Bayes classiers work well for:", 480 | "answers": [ 481 | "linear programming", 482 | "spam filtering ", 483 | "k-center clustering", 484 | "speech recognition" 485 | ], 486 | "correct": "B", 487 | "answer_have_code": "0", 488 | "code": "", 489 | "img": "", 490 | "answer_explanation": "" 491 | }, 492 | { 493 | "question": "The explained variance of a clustering equals:", 494 | "answers": [ 495 | "(total variance)/(within-cluster variance)", 496 | "(within-cluster variance)/(between-cluster variance)", 497 | "(between-cluster variance)/(total variance) ", 498 | "(within-cluster variance)/(total variance)" 499 | ], 500 | "correct": "C", 501 | "answer_have_code": "0", 502 | "code": "", 503 | "img": "", 504 | "answer_explanation": "" 505 | }, 506 | { 507 | "question": "A binary classifier on 6 points gives the probabilities: 0.9, 0.85, 0.75, 0.5, 0.4, 0.3; the correct labels are 1,1,0,1,0,0. What is the best probability threshold, if we need FPR <= 1/3?", 508 | "answers": [ 509 | "0.45 ", 510 | "1.0", 511 | "0.95", 512 | "0.25" 513 | ], 514 | "correct": "A", 515 | "answer_have_code": "0", 516 | "code": "", 517 | "img": "", 518 | "answer_explanation": "" 519 | }, 520 | { 521 | "question": "Mark the wrong statement about gradient descent:", 522 | "answers": [ 523 | "batch gradient descent approximates \u25bdf using a mini-batch", 524 | "stochastic gradient descent approximates \u25bdf with a single example", 525 | "there is no guarantee to nd the global minimum", 526 | "increasing the learning rate damps oscillations " 527 | ], 528 | "correct": "D", 529 | "answer_have_code": "0", 530 | "code": "", 531 | "img": "", 532 | "answer_explanation": "" 533 | }, 534 | { 535 | "question": "Which task does not require to learn a model?", 536 | "answers": [ 537 | "Clustering ", 538 | "Linear Regression", 539 | "Classication", 540 | "Logistic Regression" 541 | ], 542 | "correct": "A", 543 | "answer_have_code": "0", 544 | "code": "", 545 | "img": "", 546 | "answer_explanation": "" 547 | }, 548 | { 549 | "question": "For two sets A, B the probability that the first element in a random permutation of A U B is in A \u2229 B:", 550 | "answers": [ 551 | "is J(A,B) / |A \u2229 B|", 552 | "is J(A,B) ", 553 | "is 1/|A|+1/|B|", 554 | "is 1/(|A||B|)" 555 | ], 556 | "correct": "B", 557 | "answer_have_code": "0", 558 | "code": "", 559 | "img": "", 560 | "answer_explanation": "" 561 | }, 562 | { 563 | "question": "The R^2 and the p-values of a regression:", 564 | "answers": [ 565 | "are always equivalent", 566 | "cannot be both positive", 567 | "measure different aspects ", 568 | "are negatively correlated" 569 | ], 570 | "correct": "C", 571 | "answer_have_code": "0", 572 | "code": "", 573 | "img": "", 574 | "answer_explanation": "" 575 | }, 576 | { 577 | "question": "xXmini=1k||x-ci||22 is the objective function of:", 578 | "answers": [ 579 | "k-squares", 580 | "k-medians", 581 | "k-centers", 582 | "k-means" 583 | ], 584 | "correct": "D", 585 | "answer_have_code": "0", 586 | "code": "", 587 | "img": "", 588 | "answer_explanation": "" 589 | }, 590 | { 591 | "question": "Classification accuracy is misleading when:", 592 | "answers": [ 593 | "the label proportions are unbalanced ", 594 | "the label proportions are balanced", 595 | "the dataset is too small", 596 | "the dataset is too large" 597 | ], 598 | "correct": "A", 599 | "answer_have_code": "0", 600 | "code": "", 601 | "img": "", 602 | "answer_explanation": "" 603 | }, 604 | { 605 | "question": "A binary classifier on 6 points gives the probabilities: 0.85, 0.75, 0.65, 0.5, 0.4, 0.2; the correct labels are 1,1,1,0,0,0. What is the best probability threshold?", 606 | "answers": [ 607 | "0.3", 608 | "0.6 ", 609 | "0.7", 610 | "0.9" 611 | ], 612 | "correct": "B", 613 | "answer_have_code": "0", 614 | "code": "", 615 | "img": "", 616 | "answer_explanation": "" 617 | }, 618 | { 619 | "question": "An algorithm is considered practical if its running time, as a function of the input size, is:", 620 | "answers": [ 621 | "exponential", 622 | "polynomial ", 623 | "linear", 624 | "logarithmic" 625 | ], 626 | "correct": "B", 627 | "answer_have_code": "0", 628 | "code": "", 629 | "img": "", 630 | "answer_explanation": "" 631 | }, 632 | { 633 | "question": "The naive Bayes classier learns:", 634 | "answers": [ 635 | "the marginal distribution of predictors", 636 | "the joint distribution of predictors", 637 | "the joint distribution of predictors and labels ", 638 | "the marginal distribution of labels" 639 | ], 640 | "correct": "C", 641 | "answer_have_code": "0", 642 | "code": "", 643 | "img": "", 644 | "answer_explanation": "" 645 | }, 646 | { 647 | "question": "k-PCA differs from k-means in that xi is:", 648 | "answers": [ 649 | "any PCA component", 650 | "any linear combination of PCA components ", 651 | "orthogonal to all PCA components", 652 | "any a convex combination of PCA components" 653 | ], 654 | "correct": "B", 655 | "answer_have_code": "0", 656 | "code": "", 657 | "img": "", 658 | "answer_explanation": "" 659 | }, 660 | { 661 | "question": "In logistic regression, the estimated probability of xi being a positive is:", 662 | "answers": [ 663 | "1/(1+e-Tx) ", 664 | "1/(1+|x|2)", 665 | "log(Tx/(1-Tx))", 666 | "log(xi)" 667 | ], 668 | "correct": "A", 669 | "answer_have_code": "0", 670 | "code": "", 671 | "img": "", 672 | "answer_explanation": "" 673 | }, 674 | { 675 | "question": "A sports betting agency wants to predict whether the Italian national football team will or not qualify for the World Cup championship. They should use:", 676 | "answers": [ 677 | "Clustering", 678 | "Logistic regression ", 679 | "Linear programming", 680 | "Linear regression" 681 | ], 682 | "correct": "B", 683 | "answer_have_code": "0", 684 | "code": "", 685 | "img": "", 686 | "answer_explanation": "" 687 | }, 688 | { 689 | "question": "A problem X NP is said to be NP-complete if:", 690 | "answers": [ 691 | "X can be reduced to every Y NP in polytime", 692 | "every Y NP can be reduced to X in polytime", 693 | "no Y NP can be reduced to X in polytime", 694 | "none of the others" 695 | ], 696 | "correct": "B", 697 | "answer_have_code": "0", 698 | "code": "", 699 | "img": "", 700 | "answer_explanation": "" 701 | }, 702 | { 703 | "question": "The quadratic loss of linear regression is:", 704 | "answers": [ 705 | "i=1m(yi-yi)2", 706 | "i=1m(xi-xi)2", 707 | "i=1m(xi-yi)2", 708 | "i=1m(yi2-yi2)2" 709 | ], 710 | "correct": "A", 711 | "answer_have_code": "0", 712 | "code": "", 713 | "img": "", 714 | "answer_explanation": "" 715 | }, 716 | { 717 | "question": "What is the best threshold value for turning probability scores into binary predictions?", 718 | "answers": [ 719 | "the one that maximizes sensitivity", 720 | "it depends on the problem ", 721 | "the one that maximizes accuracy", 722 | "the one that maximizes specificity" 723 | ], 724 | "correct": "B", 725 | "answer_have_code": "0", 726 | "code": "", 727 | "img": "", 728 | "answer_explanation": "" 729 | }, 730 | { 731 | "question": "In Human coding, the encoder:", 732 | "answers": [ 733 | "processes whole runs of identical input symbols", 734 | "works by solving a clustering problem", 735 | "works by solving a regression problem", 736 | "processes each input symbol individually " 737 | ], 738 | "correct": "D", 739 | "answer_have_code": "0", 740 | "code": "", 741 | "img": "", 742 | "answer_explanation": "" 743 | }, 744 | { 745 | "question": "The Maximum Likelihood Estimator for the parameters of a linear model with independent Gaussian noise is:", 746 | "answers": [ 747 | "the OLS solution vector * ", 748 | "the square root of the OLS solution *", 749 | "it depends on the dataset", 750 | "the vector of the generating process" 751 | ], 752 | "correct": "A", 753 | "answer_have_code": "0", 754 | "code": "", 755 | "img": "", 756 | "answer_explanation": "" 757 | }, 758 | { 759 | "question": "Consider the LP: min f(x,y)=x+y; x+y2; x,y0. The corresponding polytope is:", 760 | "answers": [ 761 | "degenerate", 762 | "bounded", 763 | "unbounded", 764 | "empty " 765 | ], 766 | "correct": "D", 767 | "answer_have_code": "0", 768 | "code": "", 769 | "img": "", 770 | "answer_explanation": "" 771 | }, 772 | { 773 | "question": "Min-hashing maps each document to:", 774 | "answers": [ 775 | "one hash signature ", 776 | "a distance matrix", 777 | "the set of most frequent terms", 778 | "a real vector" 779 | ], 780 | "correct": "A", 781 | "answer_have_code": "0", 782 | "code": "", 783 | "img": "", 784 | "answer_explanation": "" 785 | }, 786 | { 787 | "question": "How do you do a linear regression in R?", 788 | "answers": [ 789 | "predict(y x, data)", 790 | "lm(y x, data) ", 791 | "predict(y x, data, family=\"binomial\")", 792 | "lm(y x, data, family=\"binomial\")" 793 | ], 794 | "correct": "B", 795 | "answer_have_code": "0", 796 | "code": "", 797 | "img": "", 798 | "answer_explanation": "" 799 | }, 800 | { 801 | "question": "How do you measure the significance of an estimate?", 802 | "answers": [ 803 | "with its magnitude", 804 | "with R^2", 805 | "with its p-value", 806 | "with its sign" 807 | ], 808 | "correct": "C", 809 | "answer_have_code": "0", 810 | "code": "", 811 | "img": "", 812 | "answer_explanation": "" 813 | }, 814 | { 815 | "question": "A manufacturing company wants to nd out the relationship between the budget spent in advertising and the total sales of the next semester. They could use:", 816 | "answers": [ 817 | "Linear Regression", 818 | "Logistic Regression", 819 | "Clustering", 820 | "Linear Programming" 821 | ], 822 | "correct": "A", 823 | "answer_have_code": "0", 824 | "code": "", 825 | "img": "", 826 | "answer_explanation": "" 827 | }, 828 | { 829 | "question": "The company wants to predict if a machine will have a technical failure in the next 10 days. This could be done with:", 830 | "answers": [ 831 | "Linear Regression", 832 | "Logistic Regression", 833 | "Clustering", 834 | "Linear Programming" 835 | ], 836 | "correct": "B", 837 | "answer_have_code": "0", 838 | "code": "", 839 | "img": "", 840 | "answer_explanation": "" 841 | }, 842 | { 843 | "question": "Moreover, items from the same production line are similar while those from different lines are radically different. You suggest to check by using:", 844 | "answers": [ 845 | "Linear Regression", 846 | "Logistic Regression", 847 | "Clustering", 848 | "Linear Programming" 849 | ], 850 | "correct": "C", 851 | "answer_have_code": "0", 852 | "code": "", 853 | "img": "", 854 | "answer_explanation": "" 855 | }, 856 | { 857 | "question": "What is the true positive rate aka sensitivity?", 858 | "answers": [ 859 | "the fraction of negatives that are incorrectly classified", 860 | "the fraction of negatives that are correctly classified", 861 | "the fraction of positives that are incorrectly classified", 862 | "the fraction of positives that are correctly classified" 863 | ], 864 | "correct": "D", 865 | "answer_have_code": "0", 866 | "code": "", 867 | "img": "", 868 | "answer_explanation": "" 869 | }, 870 | { 871 | "question": "Single-linkage clustering works by:", 872 | "answers": [ 873 | "repeatedly recomputing the centroids of clusters", 874 | "repeatedly merging smaller clusters into larger ones", 875 | "enumerating all possible clustering of the given points", 876 | "enumerating all possible points in a cluster" 877 | ], 878 | "correct": "B", 879 | "answer_have_code": "0", 880 | "code": "", 881 | "img": "", 882 | "answer_explanation": "" 883 | }, 884 | { 885 | "question": "You have a set of observations (x; y) with x; y 2 R. Which one of the following gives the highest R2?", 886 | "answers": [ 887 | "Simple linear regression", 888 | "Polynomial regression of degree 2", 889 | "Polynomial regression of degree 10", 890 | "Logistic regression\t" 891 | ], 892 | "correct": "C", 893 | "answer_have_code": "0", 894 | "code": "", 895 | "img": "", 896 | "answer_explanation": "" 897 | }, 898 | { 899 | "question": "Which one of the following performances indicates the best model for prediction?", 900 | "answers": [ 901 | "R2 = 0:2 on training, R2 = 0:1 on test", 902 | "R2 = 0:7 on training, R2 = 0:7 on test", 903 | "R2 = 0:8 on training, R2 = 0:1 on test", 904 | "R2 = 0:9 on training, R2 = \udbc0\udc000:9 on test" 905 | ], 906 | "correct": "B", 907 | "answer_have_code": "0", 908 | "code": "", 909 | "img": "", 910 | "answer_explanation": "" 911 | }, 912 | { 913 | "question": "Which task does not require a training set (i.e. a dataset used for learning a model)?", 914 | "answers": [ 915 | "Linear Regression", 916 | "Logistic Regression", 917 | "Classification", 918 | "Clustering" 919 | ], 920 | "correct": "D", 921 | "answer_have_code": "0", 922 | "code": "", 923 | "img": "", 924 | "answer_explanation": "" 925 | }, 926 | { 927 | "question": "If you have n points, what is the number of clusters that minimizes the within-cluster sum of squares?", 928 | "answers": [ 929 | "1", 930 | "k", 931 | "n", 932 | "we cannot say" 933 | ], 934 | "correct": "C", 935 | "answer_have_code": "0", 936 | "code": "", 937 | "img": "", 938 | "answer_explanation": "" 939 | }, 940 | { 941 | "question": "In the bias-variance decomposition of the expected squared error, what does a high bias suggest?", 942 | "answers": [ 943 | "noisy data", 944 | "overtting", 945 | "undertting", 946 | "crosstting" 947 | ], 948 | "correct": "C", 949 | "answer_have_code": "0", 950 | "code": "", 951 | "img": "", 952 | "answer_explanation": "" 953 | }, 954 | { 955 | "question": "A set of observations (x1; y1), (x2; y2), \u2026,(xn; yn) obeys the law yi := axi + b + i where i is some random noise. The task of estimating a and b from the dataset is called:", 956 | "answers": [ 957 | "logistic regression", 958 | "linear regression", 959 | "linear programming", 960 | "logistic programming" 961 | ], 962 | "correct": "B", 963 | "answer_have_code": "0", 964 | "code": "", 965 | "img": "", 966 | "answer_explanation": "" 967 | }, 968 | { 969 | "question": "A regression model (M1) on a training set gives R^2 = 0.5 while a second model (M2) gives R^2 = 0.9. What can we say about predictions on a test set?", 970 | "answers": [ 971 | "M2 will have error smaller than M1", 972 | "M2 will have error larger than M1", 973 | "M2 will have the same error as M1", 974 | "we cannot say" 975 | ], 976 | "correct": "D", 977 | "answer_have_code": "0", 978 | "code": "", 979 | "img": "", 980 | "answer_explanation": "" 981 | }, 982 | { 983 | "question": "You developed a clinical test to distinguish sick patients from healthy patients. In the population, on average 998 out of 1000 people are healthy, and the test gives an incorrect prediction in 0.5% of the cases. This means the test:", 984 | "answers": [ 985 | "identifies all the healthy patients", 986 | "identifies all the sick patients", 987 | "could miss all the healthy patients", 988 | "could miss all the sick patients" 989 | ], 990 | "correct": "D", 991 | "answer_have_code": "0", 992 | "code": "", 993 | "img": "", 994 | "answer_explanation": "" 995 | }, 996 | { 997 | "question": "How would you describe overfitting?", 998 | "answers": [ 999 | "the model is too complex and follows the noise", 1000 | "the model is too complex and discards the noise", 1001 | "the model is too simple and follows the noise", 1002 | "the model is too simple and discards the noise" 1003 | ], 1004 | "correct": "A", 1005 | "answer_have_code": "0", 1006 | "code": "", 1007 | "img": "", 1008 | "answer_explanation": "" 1009 | }, 1010 | { 1011 | "question": "You have to convert the scores given by a logistic regression model into binary predictions. What is the best threshold?", 1012 | "answers": [ 1013 | "the one that maximizes accuracy", 1014 | "the one that maximizes TPR", 1015 | "the one that maximizes FPR", 1016 | "it depends on the requirements" 1017 | ], 1018 | "correct": "D", 1019 | "answer_have_code": "0", 1020 | "code": "", 1021 | "img": "", 1022 | "answer_explanation": "" 1023 | }, 1024 | { 1025 | "question": "Given a linear regression model, the expected squared error can be usefully decomposed in:", 1026 | "answers": [ 1027 | "SSE and SST", 1028 | "underfit, overfit and noise", 1029 | "bias, variance, and error", 1030 | "variance and covariance" 1031 | ], 1032 | "correct": "C", 1033 | "answer_have_code": "0", 1034 | "code": "", 1035 | "img": "", 1036 | "answer_explanation": "" 1037 | }, 1038 | { 1039 | "question": "Look at the confusion matrix below (1=positive=true,0=negative=false). What can we say?", 1040 | "answers": [ 1041 | "the specificity is 2/3", 1042 | "the sensitivity is 2/3", 1043 | "the accuracy is 2/3", 1044 | "none of the above" 1045 | ], 1046 | "correct": "A", 1047 | "answer_have_code": "0", 1048 | "code": "", 1049 | "img": "FDS/1positive0negative.png", 1050 | "answer_explanation": "" 1051 | }, 1052 | { 1053 | "question": "You are using k-means, and notice that different executions give different results. This happens since:", 1054 | "answers": [ 1055 | "k-means is randomized", 1056 | "clustering can take exponential time", 1057 | "this is unsupervised learning", 1058 | "you are using the wrong value for k" 1059 | ], 1060 | "correct": "A", 1061 | "answer_have_code": "0", 1062 | "code": "", 1063 | "img": "", 1064 | "answer_explanation": "" 1065 | }, 1066 | { 1067 | "question": "You have 6 observations; their class (Positive or Negative) and the score given by a logistic regression are as follows: (P,0.9), (P,0.85), (N,0.75), (P,0.5), (N,0.4), (N,0.3). If you do not want the false positive rate of your classier to exceed 1/3, the best choice is to predict \u201cY\" whenever the score is at least:", 1068 | "answers": [ 1069 | "1.2", 1070 | "1.0", 1071 | "0.45", 1072 | "0.25" 1073 | ], 1074 | "correct": "C", 1075 | "answer_have_code": "0", 1076 | "code": "", 1077 | "img": "", 1078 | "answer_explanation": "" 1079 | }, 1080 | { 1081 | "question": "Logistic regression finds the parameters that maximize: ", 1082 | "answers": [ 1083 | "the mean square error of the input data", 1084 | "the skewness of the input data", 1085 | "the inter-cluster distance of the input data", 1086 | "the log-likelihood of the input data" 1087 | ], 1088 | "correct": "D", 1089 | "answer_have_code": "0", 1090 | "code": "", 1091 | "img": "", 1092 | "answer_explanation": "" 1093 | }, 1094 | { 1095 | "question": "What does the Bayesian Optimal Classier need to know in order to work?", 1096 | "answers": [ 1097 | "the marginal distribution of each variable", 1098 | "the marginal distribution of the label", 1099 | "the joint distribution of variables and label", 1100 | "the joint distribution of the variables" 1101 | ], 1102 | "correct": "C", 1103 | "answer_have_code": "0", 1104 | "code": "", 1105 | "img": "", 1106 | "answer_explanation": "" 1107 | }, 1108 | { 1109 | "question": "Which one of the following classifiers has the best performance?", 1110 | "answers": [ 1111 | "TPR=0.2, FPR=0.2", 1112 | "TPR=0.2, FPR=0.8", 1113 | "TPR=0.8, FPR=0.2", 1114 | "TPR=0.8, FPR=0.8" 1115 | ], 1116 | "correct": "C", 1117 | "answer_have_code": "0", 1118 | "code": "", 1119 | "img": "", 1120 | "answer_explanation": "" 1121 | }, 1122 | { 1123 | "question": "Your boss calls you to tell your new regression model seems completely useless for prediction, in spite of the high R^2 of the t. You realize that probably there is:", 1124 | "answers": [ 1125 | "underfitting", 1126 | "overfitting", 1127 | "correlation", 1128 | "no tomorrow" 1129 | ], 1130 | "correct": "B", 1131 | "answer_have_code": "0", 1132 | "code": "", 1133 | "img": "", 1134 | "answer_explanation": "" 1135 | }, 1136 | { 1137 | "question": "From the confusion matrix below, what can we say?", 1138 | "answers": [ 1139 | "R^2 = 0:67", 1140 | "accuracy = 80%", 1141 | "all good things must come to an end", 1142 | "sensitivity < 80%" 1143 | ], 1144 | "correct": "B", 1145 | "answer_have_code": "0", 1146 | "code": "", 1147 | "img": "FDS/accuracy80.png", 1148 | "answer_explanation": "" 1149 | }, 1150 | { 1151 | "question": "Consider the LP: max f(x,y)=x+3y; x10; y3. The value of the optimal solution is:", 1152 | "answers": [ 1153 | "19", 1154 | "23", 1155 | "12", 1156 | "40" 1157 | ], 1158 | "correct": "A", 1159 | "answer_have_code": "0", 1160 | "code": "", 1161 | "img": "", 1162 | "answer_explanation": "" 1163 | }, 1164 | { 1165 | "question": "Your friend proposes a novel clustering algorithm that tries all possible clusterings of the data. This algorithm:", 1166 | "answers": [ 1167 | "has exponential complexity", 1168 | "is efficient but gives poor clusterings", 1169 | "has polynomial complexity", 1170 | "is efficient and gives good clusterings" 1171 | ], 1172 | "correct": "A", 1173 | "answer_have_code": "0", 1174 | "code": "", 1175 | "img": "", 1176 | "answer_explanation": "" 1177 | }, 1178 | { 1179 | "question": "In a binary classier build by thresholding the scores of a logistic regression model, the positive observations:", 1180 | "answers": [ 1181 | "have a score strictly higher than all the negatives", 1182 | "have higher density than the negatives", 1183 | "are at least as many as the negatives", 1184 | "are separated from the negatives by a hyperplane" 1185 | ], 1186 | "correct": "D", 1187 | "answer_have_code": "0", 1188 | "code": "", 1189 | "img": "", 1190 | "answer_explanation": "" 1191 | }, 1192 | { 1193 | "question": "The class NP contains all problems whose solution:", 1194 | "answers": [ 1195 | "can be verified in polytime", 1196 | "requires exponential time", 1197 | "none of the others", 1198 | "can be computed in polytime" 1199 | ], 1200 | "correct": "A", 1201 | "answer_have_code": "0", 1202 | "code": "", 1203 | "img": "", 1204 | "answer_explanation": "" 1205 | }, 1206 | { 1207 | "question": "Lloyd's algorithm for k-means works by:", 1208 | "answers": [ 1209 | "evaluating all possible points in a cluster", 1210 | "evaluating all possible clustering of the points", 1211 | "repeatedly merging clusters", 1212 | "repeatedly adjusting the centroids of clusters" 1213 | ], 1214 | "correct": "D", 1215 | "answer_have_code": "0", 1216 | "code": "", 1217 | "img": "", 1218 | "answer_explanation": "" 1219 | }, 1220 | { 1221 | "question": "You want to learn how your revenue depends on parameters such as number of working hours, etc. You could use:", 1222 | "answers": [ 1223 | "Linear Regression", 1224 | "Linear Programming", 1225 | "Logistic Regression", 1226 | "Clustering" 1227 | ], 1228 | "correct": "A", 1229 | "answer_have_code": "0", 1230 | "code": "", 1231 | "img": "", 1232 | "answer_explanation": "" 1233 | }, 1234 | { 1235 | "question": "In least squares, R^2 can be seen as:", 1236 | "answers": [ 1237 | "the norm of the parameter vector", 1238 | "none of the others", 1239 | "the gain over a baseline model", 1240 | "the inverse of the SSE" 1241 | ], 1242 | "correct": "C", 1243 | "answer_have_code": "0", 1244 | "code": "", 1245 | "img": "", 1246 | "answer_explanation": "" 1247 | }, 1248 | { 1249 | "question": "The ROC curve shows:", 1250 | "answers": [ 1251 | "specificity versus sensitivity", 1252 | "specificity versus FPR", 1253 | "TPR versus sensitivity", 1254 | "TPR versus FPR" 1255 | ], 1256 | "correct": "D", 1257 | "answer_have_code": "0", 1258 | "code": "", 1259 | "img": "", 1260 | "answer_explanation": "" 1261 | }, 1262 | { 1263 | "question": "Can feature scaling improve the model fitted via least squares?", 1264 | "answers": [ 1265 | "yes, in terms of p-values", 1266 | "no", 1267 | "yes, in terms of interpretability", 1268 | "yes, in terms of R2" 1269 | ], 1270 | "correct": "C", 1271 | "answer_have_code": "0", 1272 | "code": "", 1273 | "img": "", 1274 | "answer_explanation": "" 1275 | }, 1276 | { 1277 | "question": "Can a clustering on n points achieve 0 within-cluster sum of squares?", 1278 | "answers": [ 1279 | "yes, with 1 cluster", 1280 | "yes, with k clusters", 1281 | "yes, with n clusters", 1282 | "no, never" 1283 | ], 1284 | "correct": "C", 1285 | "answer_have_code": "0", 1286 | "code": "", 1287 | "img": "", 1288 | "answer_explanation": "" 1289 | }, 1290 | { 1291 | "question": "In linear regression, if the p-value for the estimate i is small enough, then we:", 1292 | "answers": [ 1293 | "accept the null hypothesis i = 0", 1294 | "reject the null hypothesis i = 0", 1295 | "use a model with more features", 1296 | "use a model with more parameters" 1297 | ], 1298 | "correct": "B", 1299 | "answer_have_code": "0", 1300 | "code": "", 1301 | "img": "", 1302 | "answer_explanation": "" 1303 | }, 1304 | { 1305 | "question": "Texts written in the same language have a similar letter frequency distribution. You can check this fact by:", 1306 | "answers": [ 1307 | "Logistic Regression", 1308 | "Linear Programming", 1309 | "Linear Regression", 1310 | "Clustering" 1311 | ], 1312 | "correct": "D", 1313 | "answer_have_code": "0", 1314 | "code": "", 1315 | "img": "", 1316 | "answer_explanation": "" 1317 | }, 1318 | { 1319 | "question": "Texts written in the same language have a similar letter frequency distribution. You can check this fact by:", 1320 | "answers": [ 1321 | "Logistic Regression", 1322 | "Linear Programming", 1323 | "Linear Regression", 1324 | "Clustering" 1325 | ], 1326 | "correct": "D", 1327 | "answer_have_code": "0", 1328 | "code": "", 1329 | "img": "", 1330 | "answer_explanation": "" 1331 | }, 1332 | { 1333 | "question": "Two classifiers, C1 and C2, have accuracy respectively 98\\\\% \\\\and 95%. Which one is the best?", 1334 | "answers": [ 1335 | "C1", 1336 | "They are equivalent", 1337 | "We cannot say", 1338 | "C2" 1339 | ], 1340 | "correct": "C", 1341 | "answer_have_code": "0", 1342 | "code": "", 1343 | "img": "", 1344 | "answer_explanation": "" 1345 | }, 1346 | { 1347 | "question": "Correlation clustering asks to minimize:", 1348 | "answers": [ 1349 | "The root mean squared error", 1350 | "The number of disagreements", 1351 | "The intra-cluster variance", 1352 | "The running time" 1353 | ], 1354 | "correct": "B", 1355 | "answer_have_code": "0", 1356 | "code": "", 1357 | "img": "", 1358 | "answer_explanation": "" 1359 | }, 1360 | { 1361 | "question": "If you increase the complexity of your linear regression model, eventually the SSE on the test set will:", 1362 | "answers": [ 1363 | "Approach zero", 1364 | "Cancel the training error", 1365 | "Exceed the training error", 1366 | "Become negative" 1367 | ], 1368 | "correct": "C", 1369 | "answer_have_code": "0", 1370 | "code": "", 1371 | "img": "", 1372 | "answer_explanation": "" 1373 | }, 1374 | { 1375 | "question": "Classification accuracy is misleading when:", 1376 | "answers": [ 1377 | "The label proportions are unbalanced", 1378 | "The dataset is too small", 1379 | "The label proprtions are balanced", 1380 | "The dataset is too large" 1381 | ], 1382 | "correct": "A", 1383 | "answer_have_code": "0", 1384 | "code": "", 1385 | "img": "", 1386 | "answer_explanation": "" 1387 | }, 1388 | { 1389 | "question": "The worst-case running time of the k-means algorithm on the n points is:", 1390 | "answers": [ 1391 | "Polynomial in n", 1392 | "Superpolynomial in n", 1393 | "Linear in n", 1394 | "Unbounded in n" 1395 | ], 1396 | "correct": "B", 1397 | "answer_have_code": "0", 1398 | "code": "", 1399 | "img": "", 1400 | "answer_explanation": "" 1401 | }, 1402 | { 1403 | "question": "In linear regression, the expected squared error s the sum of:", 1404 | "answers": [ 1405 | "The good the bad and the ugly", 1406 | "Squared bias and variance and noise", 1407 | "Underfit and overfit the noise", 1408 | "Variance and covariance and noise" 1409 | ], 1410 | "correct": "B", 1411 | "answer_have_code": "0", 1412 | "code": "", 1413 | "img": "", 1414 | "answer_explanation": "" 1415 | }, 1416 | { 1417 | "question": "Your friend proposes an innovative clustering algorithm that enumerates all possible clusterings of the points. This algorithm:", 1418 | "answers": [ 1419 | "Has exponential complexity", 1420 | "Has polynomial complexity", 1421 | "Is efficient but gives poor clustering", 1422 | "Is efficient and gives good clusterings" 1423 | ], 1424 | "correct": "A", 1425 | "answer_have_code": "0", 1426 | "code": "", 1427 | "img": "", 1428 | "answer_explanation": "" 1429 | }, 1430 | { 1431 | "question": "A high R^2 on a given dataset means:", 1432 | "answers": [ 1433 | "A large error on new data", 1434 | "A large error on that data", 1435 | "A small error on that data", 1436 | "A small error on new data" 1437 | ], 1438 | "correct": "C", 1439 | "answer_have_code": "0", 1440 | "code": "", 1441 | "img": "", 1442 | "answer_explanation": "" 1443 | }, 1444 | { 1445 | "question": "Multicollinearity arises if the features vectors are:", 1446 | "answers": [ 1447 | "absolutely orthonogal", 1448 | "linearly dependent", 1449 | "linearly independent", 1450 | "positive semidefinite" 1451 | ], 1452 | "correct": "B", 1453 | "answer_have_code": "0", 1454 | "code": "", 1455 | "img": "", 1456 | "answer_explanation": "" 1457 | }, 1458 | { 1459 | "question": "A logistic regression model learns:", 1460 | "answers": [ 1461 | "The conditional distribution of predictors", 1462 | "The conditional distribution of labels", 1463 | "The marginal distribution of predictors", 1464 | "The marginal distribution of labels" 1465 | ], 1466 | "correct": "B", 1467 | "answer_have_code": "0", 1468 | "code": "", 1469 | "img": "", 1470 | "answer_explanation": "" 1471 | }, 1472 | { 1473 | "question": "Consider the LP: min f(x,y) = x + y; x+y >= 2; x, y <= 0. The corresponding polytope is:", 1474 | "answers": [ 1475 | "Bounded", 1476 | "empty", 1477 | "Degenerate", 1478 | "Unbounded" 1479 | ], 1480 | "correct": "B", 1481 | "answer_have_code": "0", 1482 | "code": "", 1483 | "img": "", 1484 | "answer_explanation": "" 1485 | }, 1486 | { 1487 | "question": "To measure the efficiency of algorithms we use:", 1488 | "answers": [ 1489 | "convex analysis", 1490 | "asymptotic analysis", 1491 | "squared analysis", 1492 | "clinical analysis" 1493 | ], 1494 | "correct": "B", 1495 | "answer_have_code": "0", 1496 | "code": "", 1497 | "img": "", 1498 | "answer_explanation": "" 1499 | }, 1500 | { 1501 | "question": "Everything else being equal, what does suggest a good clustering?", 1502 | "answers": [ 1503 | "a high p-value", 1504 | "a low within-cluster sum of squares", 1505 | "a large number of observations", 1506 | "a small number of clusters" 1507 | ], 1508 | "correct": "B", 1509 | "answer_have_code": "0", 1510 | "code": "", 1511 | "img": "", 1512 | "answer_explanation": "" 1513 | }, 1514 | { 1515 | "question": "The set cover problem:", 1516 | "answers": [ 1517 | "Can be solved in constant time", 1518 | "is part of linear programming", 1519 | "is NP-Complete", 1520 | "is P-Complete" 1521 | ], 1522 | "correct": "C", 1523 | "answer_have_code": "0", 1524 | "code": "", 1525 | "img": "", 1526 | "answer_explanation": "" 1527 | }, 1528 | { 1529 | "question": "A company must allocate 5M\u20ac so that each department receives a minimum amount. You can use:", 1530 | "answers": [ 1531 | "Linear regression", 1532 | "Logistic Regression", 1533 | "Clustering", 1534 | "Linear Programming" 1535 | ], 1536 | "correct": "C", 1537 | "answer_have_code": "0", 1538 | "code": "", 1539 | "img": "", 1540 | "answer_explanation": "" 1541 | }, 1542 | { 1543 | "question": "With hierarchical clustering on n points you can get:", 1544 | "answers": [ 1545 | "Between 1 and n clusters", 1546 | "No satisfaction", 1547 | "Up to 2^n clusters", 1548 | "At most log(n) clusters" 1549 | ], 1550 | "correct": "A", 1551 | "answer_have_code": "0", 1552 | "code": "", 1553 | "img": "", 1554 | "answer_explanation": "" 1555 | }, 1556 | { 1557 | "question": "The standard assumption of linear regression is that the noise across the observations:", 1558 | "answers": [ 1559 | "is fast and furios", 1560 | "is always bounded", 1561 | "is Gaussian and correlated", 1562 | "is Gaussian and independent" 1563 | ], 1564 | "correct": "D", 1565 | "answer_have_code": "0", 1566 | "code": "", 1567 | "img": "", 1568 | "answer_explanation": "" 1569 | }, 1570 | { 1571 | "question": "The ROC curve is used to measure:", 1572 | "answers": [ 1573 | "The amount of overfitting and underfitting", 1574 | "The noise in the training dataset", 1575 | "The performance of binary classifiers", 1576 | "The MSE obtained by a linear regression\"" 1577 | ], 1578 | "correct": "C", 1579 | "answer_have_code": "0", 1580 | "code": "", 1581 | "img": "", 1582 | "answer_explanation": "" 1583 | }, 1584 | { 1585 | "question": "Geometrically, each constraint of a linear program corresponds to:", 1586 | "answers": [ 1587 | "a vector", 1588 | "A double-space", 1589 | "a cone", 1590 | "a half-space" 1591 | ], 1592 | "correct": "D", 1593 | "answer_have_code": "0", 1594 | "code": "", 1595 | "img": "", 1596 | "answer_explanation": "" 1597 | }, 1598 | { 1599 | "question": "Many well-known clustering problems are:", 1600 | "answers": [ 1601 | "impossible to solve", 1602 | "NP-hard", 1603 | "easy to solve", 1604 | "infeasible\"" 1605 | ], 1606 | "correct": "B", 1607 | "answer_have_code": "0", 1608 | "code": "", 1609 | "img": "", 1610 | "answer_explanation": "" 1611 | }, 1612 | { 1613 | "question": "A polytope is:", 1614 | "answers": [ 1615 | "The difference of half-spaces", 1616 | "the greatest gift of all", 1617 | "the union of half-spaces", 1618 | "The intersection of half spaces" 1619 | ], 1620 | "correct": "D", 1621 | "answer_have_code": "0", 1622 | "code": "", 1623 | "img": "", 1624 | "answer_explanation": "" 1625 | }, 1626 | { 1627 | "question": "Everything else being equal. What does suggest good clustering?", 1628 | "answers": [ 1629 | "Few clusters", 1630 | "low within-cluster sum of squares", 1631 | "high p-value", 1632 | "large number of points" 1633 | ], 1634 | "correct": "A", 1635 | "answer_have_code": "0", 1636 | "code": "", 1637 | "img": "", 1638 | "answer_explanation": "" 1639 | } 1640 | ] --------------------------------------------------------------------------------