GSD Questions
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

243 lines
7.6 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. \documentclass[a4paper,10pt]{article}
  2. \usepackage{a4wide}
  3. \usepackage{german}
  4. \usepackage{graphicx}
  5. \usepackage{versions}
  6. \usepackage{amsmath}
  7. \usepackage{color}
  8. \usepackage{colortbl}
  9. \usepackage{anysize}
  10. \usepackage{enumerate}
  11. \usepackage[utf8]{inputenc}
  12. \usepackage{amssymb}
  13. \usepackage{amsmath}
  14. \usepackage{tikz}
  15. \usepackage{listings}
  16. \pagestyle{empty}
  17. \setlength{\parindent}{0mm}
  18. \begin{document}
  19. \vspace*{-3cm}
  20. \hspace*{-1cm}\begin{tabular}{p{.55\linewidth}p{.55\linewidth}}
  21. \begin{minipage}{\linewidth}
  22. {\bf Global Software Development} \\
  23. Kreiker, Pape, Rieger, Todtenh"ofer\\
  24. Summer Term 2018\\\\
  25. \today\\
  26. \end{minipage}
  27. &
  28. \includegraphics[width=\linewidth]{images/logo}
  29. \end{tabular}
  30. \begin{center}
  31. {\Large\bf GSD Interview Questions}\\
  32. \end{center}
  33. %\def\loesung{}
  34. \section{Programming}
  35. \section{Algorithms and Data Structures}
  36. \section{Networking}
  37. \section{Regular Expressions and Shells}
  38. \section{Databases}
  39. %------------------------------------------------------------------------------
  40. \subsection{SQL statements}
  41. %------------------------------------------------------------------------------
  42. Write down the results of the following SQL statements on table T.
  43. \begin{quote}
  44. \begin{tabular}[t]{l|l|l|l}
  45. T & A & B & C \\
  46. \hline
  47. & 1 & blue & 10 \\
  48. & 2 & blue & 40 \\
  49. & 3 & pink & 30 \\
  50. & 4 & orange & 10 \\
  51. & 5 & orange & 20 \\
  52. & 6 & orange & 50 \\
  53. & 7 & orange & 50 \\
  54. & 8 & black & 50 \\
  55. & 9 & black & 40 \\
  56. & 10 & violet & 10 \\
  57. & 11 & violet & 20 \\
  58. & 12 & violet & 10 \\
  59. \end{tabular}
  60. \end{quote}
  61. \begin{description}
  62. \item[a.)] {\tt SELECT B, COUNT(*) FROM T GROUP BY B HAVING SUM(C)<=40}
  63. \begin{quote}
  64. \begin{tabular}[t]{|p{2.5cm}|p{2.5cm}|}
  65. \hline
  66. B & COUNT(*) \\
  67. \hline
  68. \hline
  69. \ifdefined\loesung
  70. \textcolor{red}{pink} & \textcolor{red}{1} \\[0.3cm]
  71. \hline
  72. \textcolor{red}{violet} & \textcolor{red}{3} \\[0.3cm]
  73. \hline
  74. \textcolor{red}{} & \textcolor{red}{} \\[0.3cm]
  75. \hline
  76. \textcolor{red}{} & \textcolor{red}{} \\[0.3cm]
  77. \else
  78. & \\[0.3cm]
  79. \hline
  80. & \\[0.3cm]
  81. \hline
  82. & \\[0.3cm]
  83. \hline
  84. & \\[0.3cm]
  85. \fi
  86. \hline
  87. \end{tabular}
  88. \end{quote}
  89. \item[b.)] {\tt SELECT B, COUNT(*) FROM T WHERE C>35 \\GROUP BY B HAVING COUNT(*)>=2}
  90. \begin{quote}
  91. \begin{tabular}[t]{|p{2.5cm}|p{2.5cm}|}
  92. \hline
  93. B & COUNT(*) \\
  94. \hline
  95. \hline
  96. \ifdefined\loesung
  97. \textcolor{red}{orange} & \textcolor{red}{2} \\[0.3cm]
  98. \hline
  99. \textcolor{red}{black} & \textcolor{red}{2} \\[0.3cm]
  100. \hline
  101. \textcolor{red}{} & \textcolor{red}{} \\[0.3cm]
  102. \hline
  103. \textcolor{red}{} & \textcolor{red}{} \\[0.3cm]
  104. \else
  105. & \\[0.3cm]
  106. \hline
  107. & \\[0.3cm]
  108. \hline
  109. & \\[0.3cm]
  110. \hline
  111. & \\[0.3cm]
  112. \fi
  113. \hline
  114. \end{tabular}
  115. \end{quote}
  116. \end{description}
  117. %------------------------------------------------------------------------------
  118. \subsection{Constraints \& Integrity}
  119. %------------------------------------------------------------------------------
  120. The following table definition with integrity constraints are given.
  121. \begin{quote}
  122. {\tt
  123. \begin{tabbing}
  124. CREATE TABLE T1 (\=A INT, B INT, C INT,\\
  125. \>CONSTRAINT T1\_PS PRIMARY KEY (A,B),\\
  126. \>CONSTRAINT T1\_SK UNIQUE (C));\\
  127. \\
  128. CREATE TABLE T2 (A INT, B INT, C INT, D INT, E INT,\\
  129. \>CONSTRAINT T2\_PS PRIMARY KEY (A),\\
  130. \>CONSTRAINT T2\_FS1 FOREIGN KEY (B,C) REFERENCES T1(A,B),\\
  131. \>CONSTRAINT T2\_FS2 FOREIGN KEY (D) REFERENCES T1(C),\\
  132. \>CONSTRAINT T2\_E\_NN CHECK (E IS NOT NULL),\\
  133. \>CONSTRAINT T2\_E\_13 CHECK (E BETWEEN 1 AND 3)); \\
  134. \end{tabbing}}
  135. \end{quote}
  136. The table T1 and T2 contain the following tuples. NULL values are indicated by a hyphen (-).
  137. \begin{quote}
  138. \begin{tabular}[t]{l|l|l|l}
  139. T1 & A & B & C \\
  140. \hline
  141. & 1 & 1 & 5 \\
  142. & 2 & 2 & 10 \\
  143. & 3 & 3 & 15 \\
  144. & 4 & 4 & 20 \\
  145. & 5 & 5 & 25 \\
  146. \end{tabular}
  147. \hspace{2cm}
  148. \begin{tabular}[t]{l|l|l|l|l|l}
  149. T2 & A & B & C & D & E\\
  150. \hline
  151. & 100 & - & - & 15 & 1 \\
  152. & 101 & 2 & 2 & 25 & 2 \\
  153. & 102 & 2 & 2 & - & 3 \\
  154. & 103 & 3 & 3 & 10 & 3 \\
  155. & 104 & 3 & 3 & 10 & 3 \\
  156. \end{tabular}
  157. \end{quote}
  158. Which of the following INSERT-statements are violating/not violating the defined integrity constraints? Only one integrity constraint will be violated for each statement. Enter the name of the violated integrity constraint or ''none'' if all conditions are met.
  159. \begin{tabular}[t]{|l|l|l|}
  160. \hline
  161. Nr. & INSERT-statement & Violated constraint \\[0.3cm]
  162. \hline
  163. 1 & {\tt INSERT INTO T1 VALUES (1, 2, 5)} & \ifdefined\loesung \textcolor{red}{T1\_SK} \fi \\[0.3cm]
  164. \hline
  165. 2 & {\tt INSERT INTO T1 VALUES (1, 2, 30)} & \ifdefined\loesung \textcolor{red}{none} \fi \\[0.3cm]
  166. \hline
  167. 3 & {\tt INSERT INTO T1 VALUES (1, 1, 50)} & \ifdefined\loesung \textcolor{red}{T1\_PS} \fi \\[0.3cm]
  168. \hline
  169. 4 & {\tt INSERT INTO T1 VALUES (1, NULL, NULL)} & \ifdefined\loesung \textcolor{red}{T1\_PS} \fi \\[0.3cm]
  170. \hline
  171. 5 & {\tt INSERT INTO T2 VALUES (117, 2, 2, 5, 5)} & \ifdefined\loesung \textcolor{red}{T2\_E\_13} \fi \\[0.3cm]
  172. \hline
  173. 6 & {\tt INSERT INTO T2 VALUES (109, 3, 1, 10, 3)} & \ifdefined\loesung \textcolor{red}{T2\_FS1} \fi \\[0.3cm]
  174. \hline
  175. 7 & {\tt INSERT INTO T2 VALUES (103, 1, 1, 20, 2)} & \ifdefined\loesung \textcolor{red}{T2\_PS} \fi \\[0.3cm]
  176. \hline
  177. 8 & {\tt INSERT INTO T2 VALUES (110, 4, 4, 35, 1)} & \ifdefined\loesung \textcolor{red}{T2\_FS2} \fi \\[0.3cm]
  178. \hline
  179. \end{tabular}
  180. %------------------------------------------------------------------------------
  181. \subsection{Relations \& DDL-statements}
  182. %------------------------------------------------------------------------------
  183. The following tables and DDL-statements are given. Please note: an exam with a grade other than 5.0 is passed.
  184. \begin{figure}[htb]
  185. \begin{minipage}{0.30\linewidth}
  186. \includegraphics[width=38mm]{images/task3-chen.pdf}
  187. \end{minipage}
  188. %\hfill
  189. \begin{minipage}{0.55\linewidth}
  190. \scriptsize\lstinputlisting[numbers=none]{queries/task3-ddl.sql}
  191. \end{minipage}
  192. \end{figure}
  193. \begin{description}
  194. \item[a.)] What is defined in the table {\tt STUDENT}?
  195. \ifdefined\loesung \textcolor{red}{
  196. \begin{itemize}
  197. \item the student's Id is the primary key
  198. \item a student's Id have to be between 100000 and 999999
  199. \item the GENDER column is restricted to 'm' for male and 'f' for female
  200. \end{itemize}}\else \vfill \fi
  201. \item[b.)] What is defined in the table {\tt EXAM}?
  202. \ifdefined\loesung \textcolor{red}{
  203. \begin{itemize}
  204. \item the primary key is composed of the student's Id, the attempt and the course name
  205. \item an exam can be taken three times
  206. \item the possible grades for an exam are 1.0, 1.3, 1.7, 2.0, 2.3, 2.7, 3.0, 3.3, 3.7, 4.0, 5.0
  207. \item the referenced student Id must exist in the {\tt STUDENT} table ({\tt FOREIGN KEY})
  208. \item the deletion of a student will also delete all associated exams ({\tt ON DELETE CASCADE})
  209. \end{itemize}}\else \vfill \fi
  210. \item[c.)] Define a SQL query to find students (student's Id, firstname, lastname and course) who failed in the third attempt?
  211. \begin{quote}
  212. \ifdefined\loesung \textcolor{red}{\tt SELECT S.STUDENT\_ID, S.LASTNAME, E.COURSE FROM STUDENT S, EXAM E \\ WHERE S.STUDENT\_ID=E.STUDENT\_ID AND ATTEMPT=3 AND GRADE=5}\else \vfill \fi
  213. \end{quote}
  214. \item[d.)] Define a SQL query to report the average attempts for male and female students?
  215. \begin{quote}
  216. \ifdefined\loesung \textcolor{red}{\tt SELECT S.GENDER, AVG(ATTEMPT) FROM STUDENT S, EXAM E \\ WHERE S.STUDENT\_ID=E.STUDENT\_ID AND NOT GRADE=5 GROUP BY S.GENDER}\else \vfill \fi
  217. \end{quote}
  218. \end{description}
  219. %------------------------------------------------------------------------------
  220. \end{document}
  221. %------------------------------------------------------------------------------