VelocerUygulamayı aç

Velocer › Bilgi kartları › University of Wisconsin–Madison › CS 574: Data Security and Privacy · UW-Madison

CS 574: Data Security and Privacy · UW-Madison

For CS 574 exam review. · stack_and_sprout tarafından · 167 kart

University of Wisconsin–Madison

Bu desteyi çalış Göm

  1. What does ACID stand for in relational database transactions?Atomicity, Consistency, Isolation, Durability.
  2. What is the purpose of Relational Algebra in databases?It provides a formal query language for expressing operations on relations, forming the theoretical foundation for SQL queries.
  3. What is BSON in MongoDB?A binary-encoded serialization format used by MongoDB to store documents, extending JSON with additional data types.
  4. What is MQL?MongoDB Query Language, the syntax used to query and manipulate documents in MongoDB.
  5. What is an aggregation pipeline in MongoDB?A framework of staged operations that process documents through multiple transformations to compute aggregated results.
  6. What is GeoJSON used for in MongoDB?It is a format for encoding geographic data structures, enabling spatial indexing and geospatial queries.
  7. What is Elasticsearch built on, and what is its core data structure?It is built on Apache Lucene and uses distributed inverted indexes for full-text search.
  8. What is BM25 in Elasticsearch?A relevance scoring algorithm that ranks documents based on term frequency, inverse document frequency, and document length.
  9. What is kNN vector search used for in Elasticsearch?It finds the nearest vectors to a query vector, enabling similarity search for embeddings and unstructured data.
  10. What does SSH provide in system administration?Secure encrypted remote access to systems for administration and data transfer.
  11. What are OLAP window functions used for in SQL?They perform calculations across a set of rows related to the current row, enabling analytics like running totals and rankings without collapsing rows.
  12. What is the purpose of query auditing in data security?To monitor, log, and analyze database queries to detect unauthorized access, enforce policies, and ensure correctness and compliance.
  13. What is a nested mapping in Elasticsearch?A mapping that allows arrays of objects to be indexed independently so each object's fields are queried as a unit.
  14. What is a Lucene analyzer responsible for?It converts text into tokens through character filtering, tokenization, and token filtering to prepare text for indexing and search.
  15. What command generates an SSH key pair?ssh-keygen generates a private key and a matching public key.
  16. Where is the SSH private key stored, and how should it be handled?It is stored on the client (e.g., ~/.ssh/id_rsa or id_ed25519) and must be kept strictly secret.
  17. Where must the SSH public key be placed to enable login on a remote server?It is appended to ~/.ssh/authorized_keys on the remote VM.
  18. Why does OpenSSH refuse key authentication based on file permissions?OpenSSH rejects key auth if directory or file permissions allow other users write access, so permissions must be hardened.
  19. Which file holds the server-side SSH daemon configuration, and how is it reloaded?It lives in /etc/ssh/sshd_config and is reloaded with sudo service ssh restart.
  20. What does SSH local port forwarding accomplish?It securely forwards traffic from a local machine port to a service bound to localhost on a remote server.
  21. Give examples of services commonly reached via SSH local port forwarding.JupyterLab on port 8888, Kibana on 5601, and MySQL on 3306.
  22. In SSH key authentication, which key stays on the client and which goes to the server?The private key stays secret on the client; the public key is placed in authorized_keys on the server.
  23. What is the purpose of the authorized_keys file?It lists public keys permitted to authenticate to the account on the remote server.
  24. What is asymmetric key authentication in SSH?A method where a client proves identity using a private key while the server verifies it with the corresponding public key.
  25. What are the three permission scopes in POSIX permission bits?User/Owner (u), Group (g), and Others (o).
  26. What numeric values correspond to the read, write, and execute permission bits?Read (r) = 4, Write (w) = 2, Execute (x) = 1.
  27. What does the octal permission 755 represent in symbolic notation?rwxr-xr-x (owner: read/write/execute, group: read/execute, others: read/execute).
  28. What does the octal permission 600 represent in symbolic notation?rw------- (owner: read/write, group: none, others: none).
  29. What are the file descriptor numbers for stdin, stdout, and stderr?stdin = 0, stdout = 1, stderr = 2.
  30. In a shell pipeline like cmdA | cmdB, what happens to stderr?stderr is not piped across the pipe; it prints directly to the terminal unless explicitly redirected.
  31. What is the difference between > and >> for output redirection?> truncates the file and writes stdout; >> appends stdout to the end of the file.
  32. How do you redirect only stderr to a file?Use 2> filename (e.g., cmd 2> err.log).
  33. How do you redirect both stdout and stderr to the same file?Use &> filename or > filename 2>&1.
  34. What does the && operator do between two commands?Runs the first command, and executes the second command only if the first exits with status 0 (success).
  35. What does appending & to a command do?Launches the command asynchronously in the background and immediately returns shell control.
  36. What is the difference between kill <PID> and kill -9 <PID>?kill <PID> sends SIGTERM (15) for graceful termination; kill -9 <PID> sends SIGKILL (9) for immediate termination.
  37. What is a database transaction?A logical unit of work comprising one or more database reads and/or writes.
  38. What does the A in ACID stand for, and what does it mean?Atomicity ("All-or-Nothing"): either every operation in the transaction completes and is committed, or if any statement fails, the entire transaction is aborted and rolled back to its pre-transaction state.
  39. What does the C in ACID stand for, and what does it mean?Consistency (Integrity Preservation): every committed transaction transitions the database from one valid state to another, preserving all declared schema constraints such as PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK, and triggers.
  40. What does the I in ACID stand for, and what does it mean?Isolation (Concurrency Control): concurrent transactions execute as if isolated from one another, and uncommitted intermediate modifications of one transaction cannot corrupt other concurrent transactions.
  41. What does the D in ACID stand for, and what does it mean?Durability (Crash Persistence): once a transaction commits, its modifications are permanently recorded in non-volatile storage (write-ahead logs / disk) and survive power loss or system crashes.
  42. Which ACID property guarantees that a failed statement undoes the entire transaction?Atomicity — the transaction is aborted and rolled back to its pre-transaction state.
  43. Which ACID property relies on schema constraints like PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, and CHECK?Consistency — committed transactions must preserve all declared schema constraints.
  44. Which ACID property prevents uncommitted changes from corrupting other concurrent transactions?Isolation (Concurrency Control).
  45. Which ACID property ensures committed data survives a power loss or system crash?Durability — modifications are written to non-volatile storage such as write-ahead logs or disk.
  46. What mechanism commonly provides durability for committed transactions?Write-ahead logs and disk (non-volatile storage).
  47. What happens to a transaction if any of its statements fails?Under atomicity, the entire transaction is aborted and rolled back to its pre-transaction state.
  48. What is the difference between atomicity and durability?Atomicity is about all-or-nothing execution of a transaction's operations; durability is about committed changes persisting permanently across crashes.
  49. What is the difference between consistency and isolation in ACID?Consistency ensures each committed transaction moves the database between valid states preserving constraints; isolation ensures concurrent transactions don't see or corrupt each other's uncommitted work.
  50. What SQL command permanently records a transaction's changes?COMMIT.
  51. What does the COMMIT command do in terms of ACID properties?It permanently records the transaction's modifications in non-volatile storage, satisfying durability.
  52. What does the ROLLBACK command do?It aborts the transaction and undoes its changes, returning the database to its pre-transaction state (atomicity).
  53. What is the difference between CHAR(n) and VARCHAR(n) in MySQL?CHAR(n) is fixed-length (up to 255 bytes) and right-padded with spaces; VARCHAR(n) is variable-length (up to 65,535 bytes) with a 1–2 byte length prefix.
  54. When would you choose CHAR over VARCHAR?When storing fixed-length codes like 2-letter state abbreviations, since CHAR is fast for fixed-length values.
  55. What are the four MySQL TEXT types, ordered by size?TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT.
  56. How many bytes does a MySQL TINYINT use, and what are its signed and unsigned ranges?1 byte; signed range is -128 to 127, UNSIGNED range is 0 to 255.
  57. What is the difference between DECIMAL and FLOAT/DOUBLE in MySQL?DECIMAL is fixed-point and exact; FLOAT and DOUBLE are floating-point and approximate.
  58. In DECIMAL(p, s), what do p and s represent?p is the total number of digits and s is the number of digits after the decimal point.
  59. What format does MySQL's DATE type use?'YYYY-MM-DD'.
  60. What format does MySQL's TIME type use?'HH:MM:SS'.
  61. What format does MySQL's DATETIME type use?'YYYY-MM-DD HH:MM:SS'.
  62. How does MySQL's TIMESTAMP type differ from DATETIME?TIMESTAMP stores a UTC-converted epoch timestamp, while DATETIME stores a literal date and time without timezone conversion.
  63. What is the logical evaluation order of a SQL query?FROM/JOIN/ON → WHERE → GROUP BY → HAVING → SELECT (and window functions) → DISTINCT → ORDER BY → LIMIT/OFFSET.
  64. Why can't a column alias defined in SELECT be used in WHERE?Because WHERE is evaluated before SELECT in the logical order, so the alias doesn't exist yet when WHERE runs.
  65. Why can't aggregate functions like SUM or COUNT appear in WHERE?WHERE runs before GROUP BY, so groups don't exist yet. Use HAVING to filter groups after aggregation.
  66. What is an uncorrelated subquery?An inner query that is completely independent of the outer query and executes once before the outer query.
  67. What is a correlated subquery?An inner query that references a column from the outer query's table and is logically re-evaluated for each outer row, often used with EXISTS/NOT EXISTS.
  68. What is the danger of using NOT IN with a subquery that returns NULL?If the subquery returns any NULL, x NOT IN (...) evaluates to UNKNOWN, producing an empty result set.
  69. What does > ANY mean in a quantified comparison?It means greater than the minimum value returned by the subquery (true if greater than at least one value).
  70. What does > ALL mean in a quantified comparison?It means greater than the maximum value returned by the subquery (true only if greater than every value).
  71. Which clause filters individual rows before grouping?WHERE, which runs before GROUP BY.
  72. Which clause filters groups after aggregation?HAVING, which runs after GROUP BY.
  73. At what point in the logical order are window functions evaluated?During the SELECT phase, after GROUP BY and HAVING.
  74. Which SQL clause runs last in the logical evaluation order?LIMIT/OFFSET, after ORDER BY.
  75. What is the difference between lexical (written) order and logical evaluation order in SQL?Lexical order is how the query is written; logical order is the sequence in which clauses are actually evaluated, starting with FROM/JOIN.
  76. When does DISTINCT execute relative to SELECT and ORDER BY?DISTINCT runs after SELECT (and window functions) but before ORDER BY.
  77. How does a window function differ from GROUP BY?GROUP BY collapses each group into a single summary row, while a window function computes across related rows but preserves every individual row.
  78. What does ROW_NUMBER() return for tied values like 100, 90, 90, 80?1, 2, 3, 4 — it assigns strictly unique consecutive integers with arbitrary tie-breaking.
  79. What does RANK() return for tied values like 100, 90, 90, 80?1, 2, 2, 4 — ties get the same rank, and subsequent rank numbers are skipped.
  80. What does DENSE_RANK() return for tied values like 100, 90, 90, 80?1, 2, 2, 3 — ties get the same rank with no gaps in the rank numbers.
  81. Which ranking function skips rank numbers after a tie?RANK() skips subsequent rank numbers after assigning the same rank to tied values.
  82. Which ranking function produces no gaps in rank numbers?DENSE_RANK() assigns the same rank to ties without leaving gaps.
  83. Which ranking function guarantees strictly unique consecutive integers?ROW_NUMBER() always returns unique consecutive integers, breaking ties arbitrarily.
  84. What is a window function?A function that computes an aggregate or ranking across a sliding window of related rows while preserving every individual row.
  85. What is BSON?BSON is MongoDB's binary-encoded serialization format for documents. It uses length prefixes for fast field skipping and supports richer data types than JSON.
  86. How many data types does standard JSON support, and what are they?JSON supports 6 data types: string, number, boolean, null, array, and object. It is human-readable plain text requiring full string parsing.
  87. What advantage do BSON length prefixes provide?Length prefixes enable fast field skipping and traversal without parsing the entire document. This makes lookups more efficient than full string parsing.
  88. What is ObjectId in MongoDB?ObjectId is a 12-byte unique identifier used as the default _id field. It is a native BSON data type.
  89. Which BSON type should be used for exact financial calculations?Decimal128. It provides exact decimal representation, avoiding floating-point rounding errors for financial data.
  90. What BSON type stores UTC milliseconds for dates?The Date type stores dates as UTC milliseconds. It is a native BSON data type not available in standard JSON.
  91. What is embedding (denormalization) in MongoDB schema design?Embedding nests related entities inside a parent document, such as order line items inside an order. It allows atomic single-document reads and writes without joins.
  92. What is linking (normalization) in MongoDB schema design?Linking stores foreign _id references across separate collections and joins them at query time via $lookup. It avoids unbounded document growth and duplication when sub-entities change frequently.
  93. What is the maximum BSON document size in MongoDB?16 MB. This limit is a key reason to use linking instead of embedding when sub-entities could grow unbounded.
  94. Which aggregation stage joins linked collections in MongoDB?$lookup. It performs a join across collections at query time for linked (normalized) documents.
  95. When should you prefer embedding over linking?Prefer embedding when related data is accessed together and sub-entities don't change frequently. It enables atomic single-document operations without joins.
  96. When should you prefer linking over embedding?Prefer linking when sub-entities change frequently or could grow unbounded beyond the 16 MB limit. It avoids duplication and document bloat.
  97. What are the key differences between JSON and BSON?JSON is human-readable text with 6 data types; BSON is binary with length prefixes and rich types like ObjectId, Date, Decimal128, Int32, Int64, BinData, and RegExp.
  98. Name three BSON-specific data types not available in standard JSON.ObjectId, Date, and Decimal128 (also Int32, Int64, BinData, RegExp). These add rich native typing beyond JSON's 6 types.
  99. Why does BSON enable faster traversal than JSON?BSON stores length prefixes for fields, allowing the database to skip over fields without parsing them. JSON requires full string parsing to navigate.
  100. What does db.col.count_documents(filter) do?Returns an exact count of documents matching the filter by scanning the matches.
  101. What does db.col.estimated_document_count() do?Returns an approximate count from collection metadata in O(1) time, without scanning documents.
  102. What does db.col.distinct("field", filter) return?An array of the distinct values of the specified field across documents matching the optional filter.
  103. What is the difference between \(exists: true and \)type: "null"?\(exists: true matches documents where the key is present, even if its value is null. \)type: "null" matches only documents where the field explicitly holds null.
  104. What does the $expr operator allow in find()?It allows aggregation expressions to compare two fields within the same document. Field names inside \(expr must be prefixed with "\)".
  105. What does {"tags": "python"} match when tags is an array?It matches if "python" is an element of the tags array.
  106. What does {"tags": {"$all": ["python", "sql"]}} match?It matches documents whose array contains both "python" and "sql", in any order.
  107. What does {"tags": {"$size": 3}} match, and what is its limitation?It matches documents whose array has exactly length 3. It cannot take a range directly; use \(expr with \)size for ranges.
  108. Why is $elemMatch needed for multi-condition array queries?Without it, conditions can be satisfied by different array elements. $elemMatch requires at least one single array element to satisfy all conditions simultaneously.
  109. What does {"items.name": "Pen", "items.qty": {"\(gt": 10}} match without \)elemMatch?It matches if any element has name "Pen" and any (possibly different) element has qty > 10, even across separate elements.
  110. What does {"items": {"\(elemMatch": {"name": "Pen", "qty": {"\)gt": 10}}}} require?At least one single array element must have name "Pen" and qty > 10 simultaneously.
  111. What does the $slice projection operator do?Returns only a specified number of array elements: a positive number returns the first N, a negative number returns the last N.
  112. How do you achieve an exact category match in Elasticsearch?Use a term query on a keyword field (e.g., category_raw) so the exact unanalyzed string is compared against the exact token.
  113. On which ports do Elasticsearch and Kibana listen by default?Elasticsearch on port 9200 and Kibana on port 5601.
  114. What is a shard in Elasticsearch and why are replica shards used?Each index is partitioned into horizontal shards; replica shards provide high availability (and read scaling) alongside primary shards.
  115. When does a newly indexed document become searchable in Elasticsearch?After an index refresh, which is triggered automatically about every 1 second (or manually via client.indices.refresh).
  116. What is the difference between a match query and a term query?match analyzes the query string before searching, while term does not analyze the query and looks for an exact token match.
  117. What does Logstash do in the ELK Stack?It is a server-side ingestion pipeline that parses, enriches, and transforms records before they reach Elasticsearch.
  118. What are Beats in the ELK Stack?Lightweight edge data shippers installed on servers to forward logs and metrics into the pipeline.
  119. What is Elasticsearch built on and what type of engine is it?It is a distributed, RESTful JSON search and analytics engine built on Apache Lucene.
  120. What does the must clause in a bool query do?Clauses that must match and contribute to the relevance _score.
  121. What does the filter clause in a bool query do?Clauses that must match but run in filter context: _score = 0.0, cached in bitsets for fast execution. Use for exact categories, dates, and price ranges.
  122. How does the should clause behave when no must or filter clause is present?It acts as a logical OR. When must/filter are present, should clauses instead boost the _score of matching documents.
  123. What is the must_not clause used for in a bool query?Exclusion in filter context, so matching documents are excluded and contribute _score = 0.0.
  124. What are the three BM25 relevance scoring factors?Term Frequency (TF), Inverse Document Frequency (IDF), and Field Length Normalization.
  125. How does Term Frequency affect BM25 scoring?More occurrences of the query term in a document increase _score, with saturating diminishing returns.
  126. How does Inverse Document Frequency (IDF) affect BM25 scoring?Rare terms across the corpus receive a much higher weight than common terms.
  127. How does field length normalization affect BM25 scoring?A match in a short field (e.g., a 3-word name) receives a higher score than a match in a 500-word description.
  128. What happens to an array of objects in standard JSON mapping?It is flattened: variants: [{"color": "Red", "size": "S"}, {"color": "Blue", "size": "L"}] becomes variants.color: ["Red", "Blue"] and variants.size: ["S", "L"], losing the pairing between elements.
  129. What problem does flattening an array of objects cause for queries?Querying color == Red AND size == L produces a false positive match because the pairing between individual array elements is lost.
  130. How do you fix the array-of-objects flattening trap?Map the field with "type": "nested", which indexes each array element as a hidden separate Lucene document, and query with a nested query.
  131. What does setting "size": 0 do in an Elasticsearch aggregation request?It suppresses hits in the response so only aggregation results are returned, which is the standard pattern for aggregation-only queries.
  132. Which Elasticsearch metric aggregation gives an approximate distinct count, and what algorithm does it use?The cardinality aggregation, which uses HyperLogLog++ to approximate distinct counts.
  133. What is the default "size" for an Elasticsearch terms bucket aggregation, and why is it a problem?The default is 10, so only the top 10 buckets are returned and smaller categories are silently dropped unless size is increased.
  134. How do you set a fixed-width numeric bucketing interval in an Elasticsearch histogram aggregation?Use the histogram aggregation with the "interval" parameter.
  135. How do you create monthly buckets in an Elasticsearch date_histogram aggregation?Use date_histogram with "calendar_interval": "month".
  136. Why is storing missing prices as a sentinel value like -1.0 dangerous for sorting?Sorting ascending on price puts the -1.0 sentinel items first, so missing values appear as the cheapest items.
  137. How does a sentinel value like -1.0 pollute an avg aggregation, and how do you prevent it?It drags the average down; prevent it by adding a range filter such as {"range": {"price": {"gt": 0}}} before aggregating.
  138. What filter should you apply before sorting or aggregating a price field that may contain sentinel values?A range filter excluding non-positive values, e.g. {"range": {"price": {"gt": 0}}}.
  139. What is the difference between metric and bucket aggregations in Elasticsearch?Metric aggregations compute a single numeric value (e.g. avg, sum), while bucket aggregations group documents into buckets (e.g. terms, histogram, date_histogram, range).
  140. Which Elasticsearch aggregation groups documents by a keyword field into categories?The terms aggregation, which groups by keyword field values.
  141. In MySQL, what is the basic data unit and where does it live?A row (tuple) stored in a table.
  142. How does MongoDB represent a data unit, and where is it stored?A BSON document stored in a collection.
  143. What is the data unit in Elasticsearch and where is it stored?A JSON document stored in the _source field of an index.
  144. How does schema enforcement differ between MySQL and MongoDB?MySQL uses strict DDL (CREATE TABLE); MongoDB is flexible with optional JSON Schema validation.
  145. In MySQL, what is the difference between WHERE and HAVING?WHERE filters rows before grouping; HAVING filters after grouping.
  146. How do you filter documents in MongoDB?Use find(filter) or a $match stage in an aggregation pipeline.
  147. What is the difference between query.bool.must and query.bool.filter in Elasticsearch?must contributes to scoring; filter is unscored and cached for faster filtering.
  148. How do you group and aggregate in MySQL?Use GROUP BY col with aggregate functions like SUM(), AVG(), and COUNT(col).
  149. What MongoDB aggregation stage performs grouping and rollups?The \(group stage, e.g. {"\)group": {"_id": "\(col", "total": {"\)sum": "$val"}}}.
  150. How are bucket and metric aggregations used in Elasticsearch?Bucket aggs (e.g. terms on keyword, date_histogram) group documents, and metric sub-aggs (avg, sum) compute values within buckets.
  151. How do you join entities in MySQL?Use INNER, LEFT, or RIGHT JOIN ... ON ... between tables.
  152. What MongoDB stage performs joins between collections?The $lookup stage using from, localField, foreignField, and as.
  153. How does Elasticsearch handle relationships instead of joins?Through denormalized documents or nested sub-documents.
  154. What MySQL feature supports window analytics?The OVER (PARTITION BY ... ORDER BY ... ROWS ...) clause.
  155. Which MongoDB stage provides window analytics?$setWindowFields with partitionBy, sortBy, and output.
  156. How does Elasticsearch perform window-style analytics?Through pipeline aggregations such as moving_fn, cumulative_sum, and derivative.
  157. How do you capture both stdout and stderr to a file in Bash?Use &> (e.g., command &> file).
  158. How do Docker containers and VMs differ regarding the OS kernel?Containers share the host OS kernel (lightweight, fast startup, no cross-OS kernel execution); VMs virtualize hardware via a hypervisor with a separate guest kernel per VM.
  159. Why is BETWEEN '2026-02-01' AND '2026-02-28' problematic on a DATETIME column?It misses everything after 00:00:00 on Feb 28 because the upper bound is midnight.
  160. When counting child matches in a LEFT JOIN, why avoid COUNT(*)?COUNT(*) counts rows including unmatched parents; use COUNT(child.pk) to count only actual child matches.
  161. In MongoDB, does {"field": {"$exists": True}} exclude null values?No, it matches null values as well as present fields.
  162. How do you match false, null, and missing values in MongoDB?Use {"field": {"$ne": True}}.
  163. When should you use $elemMatch in MongoDB?Whenever multiple predicates must hold on the same array element.
  164. What mistake should you avoid when summing a parent-level total over an array in MongoDB?Never $unwind the array before summing a parent-level total.
  165. Which Elasticsearch mapping and query type suit full-text tokenized search?Use text mapping with match queries.
  166. Which Elasticsearch mapping and query type suit exact filtering, sorting, and terms aggregations?Use keyword mapping with term queries.
  167. How do you query arrays of objects in Elasticsearch?Use nested mappings with nested queries.

Velocer ücretsizdir: aralıklı tekrar ve herhangi bir belgeden kendi kartlarınız.

PDF to flashcards · Lecture to flashcards · Practice exam · Syllabus study plan · Anki import

University of Wisconsin–Madison için diğer desteler