question stringlengths 6 3.53k | text stringlengths 17 2.05k | source stringclasses 1 value |
|---|---|---|
Assume you're working for a startup that develops a university management app. You just received a description of what the app should do:
> This app will be the administrative backbone of the university.
> Almost all staff will use it.
> Human Resources will register each student, including their personal details, and use the system to ensure each student follows the rules concerning the duration of studies, the number of courses that must be taken, the payment of all applicable fees...
> Professors will use the app to input grades and to send informational messages to students in their courses.
> Students will be able to see the list of courses and register for a course.
> Staff members will also be able to update their personal details, including their banking coordinates for their salary.
Write a user story, in a single sentence using the below format, that summarizes this conversation:
> As a student, I want to ... so that ...
Your story must contain all necessary information and only that information. | A university can obtain information regarding students' needs in numerous ways. It might create feedback section in its website. It could organize alumni panels or academic affairs to attract prospective students and collect concrete questions they are interested in. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you're working for a startup that develops a university management app. You just received a description of what the app should do:
> This app will be the administrative backbone of the university.
> Almost all staff will use it.
> Human Resources will register each student, including their personal details, and use the system to ensure each student follows the rules concerning the duration of studies, the number of courses that must be taken, the payment of all applicable fees...
> Professors will use the app to input grades and to send informational messages to students in their courses.
> Students will be able to see the list of courses and register for a course.
> Staff members will also be able to update their personal details, including their banking coordinates for their salary.
Write a user story, in a single sentence using the below format, that summarizes this conversation:
> As a student, I want to ... so that ...
Your story must contain all necessary information and only that information. | Their aim is to help students in a specific field of study. To do so, they build up a user model where they store information about abilities, knowledge and needs of the user. The system can now adapt to this user by presenting appropriate exercises and examples and offering hints and help where the user is most likely to need them. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume that some of your colleagues work on an AI-based image generation service, where a user enters a topic, and the AI generates a synthetic photo on that topic. They tell you the following about this service:
"Currently, the user types in the topic they want to see images for, and the client app sends a request to the server with the user ID and the indicated topic. The server generates an image, which takes a second or so, and sends it to the client app, which then requests another image on the same topic, and so on, until the app has received 9 images. It then displays these in a 3x3 grid. The user now looks at the 9 images and, if they see an inappropriate one, they click on a button that causes the app to send a review request to the server. Human moderators then process each report, and data scientists tweak the AI model to avoid generating images similar to the ones reported as inappropriate. Users then get a notification that their report was processed. The whole reporting process typically takes a day."
One colleague remarks that the "report an image for moderation" feature currently starts by spending 10 seconds in the background on the client side, and they have a way to speed this step up by 90%. In comparison, the optimizations you have devised for image generation would save around 30% of the current 10 seconds it takes for an entire image grid.
Explain in 1-2 sentences whether the team should prioritize optimizing the "report an image for moderation" function over image generation: | Then the generate-detect cycle is repeated. For each iteration, the generator and the discriminator use the other's feedback to improve or detect the generated images, until the discriminator can no longer distinguish between the fakes generated by its opponent and the real thing. The ability to create high quality generated imagery has increased rapidly. Unfortunately, so has its malicious use, to create deepfakes and generate video-based disinformation.At Google, Goodfellow developed a system enabling Google Maps to automatically transcribe addresses from photos taken by Street View cars and demonstrated security vulnerabilities of machine learning systems. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume that some of your colleagues work on an AI-based image generation service, where a user enters a topic, and the AI generates a synthetic photo on that topic. They tell you the following about this service:
"Currently, the user types in the topic they want to see images for, and the client app sends a request to the server with the user ID and the indicated topic. The server generates an image, which takes a second or so, and sends it to the client app, which then requests another image on the same topic, and so on, until the app has received 9 images. It then displays these in a 3x3 grid. The user now looks at the 9 images and, if they see an inappropriate one, they click on a button that causes the app to send a review request to the server. Human moderators then process each report, and data scientists tweak the AI model to avoid generating images similar to the ones reported as inappropriate. Users then get a notification that their report was processed. The whole reporting process typically takes a day."
One colleague remarks that the "report an image for moderation" feature currently starts by spending 10 seconds in the background on the client side, and they have a way to speed this step up by 90%. In comparison, the optimizations you have devised for image generation would save around 30% of the current 10 seconds it takes for an entire image grid.
Explain in 1-2 sentences whether the team should prioritize optimizing the "report an image for moderation" function over image generation: | On the other sides, this is dynamic procedure. We don't just send out this picture to everyone and we focus every response, instead, we do this in quantity. We are going to decide which picture we send it in the next, and which worker we are going to hire in the crowd in the next. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume that some of your colleagues work on an AI-based image generation service, where a user enters a topic, and the AI generates a synthetic photo on that topic. They tell you the following about this service:
"Currently, the user types in the topic they want to see images for, and the client app sends a request to the server with the user ID and the indicated topic. The server generates an image, which takes a second or so, and sends it to the client app, which then requests another image on the same topic, and so on, until the app has received 9 images. It then displays these in a 3x3 grid. The user now looks at the 9 images and, if they see an inappropriate one, they click on a button that causes the app to send a review request to the server. Human moderators then process each report, and data scientists tweak the AI model to avoid generating images similar to the ones reported as inappropriate. Users then get a notification that their report was processed. The whole reporting process typically takes a day."
Explain in 1-2 sentences what you could do on the server side, without any changes to the client app, so that users get their images faster: | The new service is less like a game. The user picks a category and they are shown a set of images. They go through each image and state whether it has been correctly categorised. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume that some of your colleagues work on an AI-based image generation service, where a user enters a topic, and the AI generates a synthetic photo on that topic. They tell you the following about this service:
"Currently, the user types in the topic they want to see images for, and the client app sends a request to the server with the user ID and the indicated topic. The server generates an image, which takes a second or so, and sends it to the client app, which then requests another image on the same topic, and so on, until the app has received 9 images. It then displays these in a 3x3 grid. The user now looks at the 9 images and, if they see an inappropriate one, they click on a button that causes the app to send a review request to the server. Human moderators then process each report, and data scientists tweak the AI model to avoid generating images similar to the ones reported as inappropriate. Users then get a notification that their report was processed. The whole reporting process typically takes a day."
Explain in 1-2 sentences what you could do on the server side, without any changes to the client app, so that users get their images faster: | Then the generate-detect cycle is repeated. For each iteration, the generator and the discriminator use the other's feedback to improve or detect the generated images, until the discriminator can no longer distinguish between the fakes generated by its opponent and the real thing. The ability to create high quality generated imagery has increased rapidly. Unfortunately, so has its malicious use, to create deepfakes and generate video-based disinformation.At Google, Goodfellow developed a system enabling Google Maps to automatically transcribe addresses from photos taken by Street View cars and demonstrated security vulnerabilities of machine learning systems. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume Your project depends on the latest available minor release version of a package instead of a hardcoded exact version, what are the pros and cons of this? | The release code is a capital letter. Backward compatibility is maintained only among versions of the same release code. The major version and minor version are incremental numbers. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume Your project depends on the latest available minor release version of a package instead of a hardcoded exact version, what are the pros and cons of this? | Because the new development initiative does not touch the code of the existing product: There is no need to regression test the existing product, saving on QA time associated with the new product launch, and reducing time to market. There is no risk of introduced bugs in the existing product, which might upset the installed user base.The downsides are: If the new product does not diverge as much as anticipated from the existing product, two code bases might need to be supported (at twice the cost) where one would have done. This can lead to expensive refactoring and manual merging down the line. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Imagine you're working at at JaaS, the Jokes-as-a-Service platform. With JaaS, everyone can be funny any time by having new jokes at their fingertips via a public API. Your first task is to convert user feedback into user stories. Here is one such piece of feedback:
"Hi, I have been using your app for a long time, but I've been recently diagnosed with diabetic retinopathy, which made me blind in both eyes, so I can’t read anymore. I've been trying to use the Voice-Over feature on my phone, since it is supposed to be able to read out loud what the app displays. However, it seems to only be able to read the title of the jokes, not the actual jokes themselves. I have not made anyone laugh in 3 months, and I feel miserable! A friend of mine told me that it could be because your app displays the jokes as images instead of text, which is not supported by the voice-over program on my phone. Please do something!"
Turn this feedback into a user story that follows the following guidelines:
1) A user story that summarizes all necessary information from the feedback
2) the user story does not contain any unnecessary information | The chat-bot now starts telling the story under the "CHILDHOOD" title, as long as the bot is in control of the conversation (the user passively responds by saying thinks like "OK" or "right"). Yet if the user asks questions, the system can either respond directly, or use up a line of the story it was going to say anyway. This, too, allows authors to reuse topics, and combine several independent topics to create a smarter chatter-bot. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Imagine you're working at at JaaS, the Jokes-as-a-Service platform. With JaaS, everyone can be funny any time by having new jokes at their fingertips via a public API. Your first task is to convert user feedback into user stories. Here is one such piece of feedback:
"Hi, I have been using your app for a long time, but I've been recently diagnosed with diabetic retinopathy, which made me blind in both eyes, so I can’t read anymore. I've been trying to use the Voice-Over feature on my phone, since it is supposed to be able to read out loud what the app displays. However, it seems to only be able to read the title of the jokes, not the actual jokes themselves. I have not made anyone laugh in 3 months, and I feel miserable! A friend of mine told me that it could be because your app displays the jokes as images instead of text, which is not supported by the voice-over program on my phone. Please do something!"
Turn this feedback into a user story that follows the following guidelines:
1) A user story that summarizes all necessary information from the feedback
2) the user story does not contain any unnecessary information | An approach to analysis of humor is classification of jokes. A further step is an attempt to generate jokes basing on the rules that underlie classification. Simple prototypes for computer pun generation were reported in the early 1990s, based on a natural language generator program, VINCI. Graeme Ritchie and Kim Binsted in their 1994 research paper described a computer program, JAPE, designed to generate question-answer-type puns from a general, i.e., non-humorous, lexicon. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Imagine you're working at JaaS, the Jokes-as-a-Service platform. With JaaS, everyone can be funny any time by having new jokes at their fingertips via a public API.
During the orientation at JaaS, the VP of engineering explains to you their workflow:
1. Branching: Developers must use a separate branch for each feature, and they must commit their code once a day.
2. Testing: When their feature is finished, developers must run a test suite locally, on their machine, and make sure that every test passes. Once that's done, they can commit and push, then open a PR describing the feature, with a screenshot of the test results attached, and wait for code reviews from colleagues.
3. Merging: If no one requested changes on the code within 24 hours, one can merge the PR to the main branch.
The above "Testing" directive contains a flaw. Give a better alternative for it and explain why your alternative is better in maximum 2 sentences: | Submitted pull requests are visible to anyone with repository access. A pull request can be accepted or rejected by maintainers.Once the pull request is reviewed and approved, it is merged into the repository. Depending on the established workflow, the code may need to be tested before being included into official release. Therefore, some projects contain a special branch for merging untested pull requests. Other projects run an automated test suite on every pull request, using a continuous integration tool, and the reviewer checks that any new code has appropriate test coverage. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Imagine you're working at JaaS, the Jokes-as-a-Service platform. With JaaS, everyone can be funny any time by having new jokes at their fingertips via a public API.
During the orientation at JaaS, the VP of engineering explains to you their workflow:
1. Branching: Developers must use a separate branch for each feature, and they must commit their code once a day.
2. Testing: When their feature is finished, developers must run a test suite locally, on their machine, and make sure that every test passes. Once that's done, they can commit and push, then open a PR describing the feature, with a screenshot of the test results attached, and wait for code reviews from colleagues.
3. Merging: If no one requested changes on the code within 24 hours, one can merge the PR to the main branch.
The above "Testing" directive contains a flaw. Give a better alternative for it and explain why your alternative is better in maximum 2 sentences: | Patterns such as feature toggles can be very useful for committing code early which is not yet ready for use by end users. Using NoSQL can eliminate the step of data migrations and schema changes, often manual steps or exceptions to a continuous delivery workflow. Other useful techniques for developing code in isolation such as code branching are not obsolete in a CD world, but must be adapted to fit the principles of CD - for example, running multiple long-lived code branches can prove impractical, as a releasable artifact must be built early in the CD process from a single code branch if it is to pass through all phases of the pipeline. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Imagine you're working at JaaS, the Jokes-as-a-Service platform. With JaaS, everyone can be funny any time by having new jokes at their fingertips via a public API.
During the orientation at JaaS, the VP of engineering explains to you their workflow:
1. Branching: Developers must use a separate branch for each feature, and they must commit their code once a day.
2. Testing: When their feature is finished, developers must run a test suite locally, on their machine, and make sure that every test passes. Once that's done, they can commit and push, then open a PR describing the feature, with a screenshot of the test results attached, and wait for code reviews from colleagues.
3. Merging: If no one requested changes on the code within 24 hours, one can merge the PR to the main branch.
The above "Merging" directive contains a flaw. Give a better alternative for it and explain why your alternative is better in maximum 2 sentences: | Submitted pull requests are visible to anyone with repository access. A pull request can be accepted or rejected by maintainers.Once the pull request is reviewed and approved, it is merged into the repository. Depending on the established workflow, the code may need to be tested before being included into official release. Therefore, some projects contain a special branch for merging untested pull requests. Other projects run an automated test suite on every pull request, using a continuous integration tool, and the reviewer checks that any new code has appropriate test coverage. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Imagine you're working at JaaS, the Jokes-as-a-Service platform. With JaaS, everyone can be funny any time by having new jokes at their fingertips via a public API.
During the orientation at JaaS, the VP of engineering explains to you their workflow:
1. Branching: Developers must use a separate branch for each feature, and they must commit their code once a day.
2. Testing: When their feature is finished, developers must run a test suite locally, on their machine, and make sure that every test passes. Once that's done, they can commit and push, then open a PR describing the feature, with a screenshot of the test results attached, and wait for code reviews from colleagues.
3. Merging: If no one requested changes on the code within 24 hours, one can merge the PR to the main branch.
The above "Merging" directive contains a flaw. Give a better alternative for it and explain why your alternative is better in maximum 2 sentences: | Patterns such as feature toggles can be very useful for committing code early which is not yet ready for use by end users. Using NoSQL can eliminate the step of data migrations and schema changes, often manual steps or exceptions to a continuous delivery workflow. Other useful techniques for developing code in isolation such as code branching are not obsolete in a CD world, but must be adapted to fit the principles of CD - for example, running multiple long-lived code branches can prove impractical, as a releasable artifact must be built early in the CD process from a single code branch if it is to pass through all phases of the pipeline. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Your team is discussing the following code:
/** Uploads images to the cloud. */
public final class ImageUploader {
public void upload(Image image) { /* … */ }
private boolean canUpload(Image image) { /* … */ }
}
One of your colleagues points out that "upload" currently has some unexpected behavior regarding file sizes, and suggests that this should be written down in a Google Doc shared with the team.
Give 1 sentence explaining why this is not a good idea and 1 sentence suggesting a better way to record this information: | With enabled Developer Mode, the users may use different capturing options: take different types of screenshots or record a video of their screen. The user may take screenshots of the whole Device Set (all launched devices will appear on a screenshot) or take screenshot of a single device. Depending on the setting "Auto-upload to cloud storage" in Menu > Settings > Captures, the user is able to: Upload the screenshot to the cloud storage. Edit the screenshot in a dedicated tool called Image Editor. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Your team is discussing the following code:
/** Uploads images to the cloud. */
public final class ImageUploader {
public void upload(Image image) { /* … */ }
private boolean canUpload(Image image) { /* … */ }
}
One of your colleagues points out that "upload" currently has some unexpected behavior regarding file sizes, and suggests that this should be written down in a Google Doc shared with the team.
Give 1 sentence explaining why this is not a good idea and 1 sentence suggesting a better way to record this information: | CaveatsThere is no native operating system support for the Cloud Files API so it is not yet possible to "map" or "mount" it as a virtual drive without third-party software like JungleDisk that translates to a supported standard such as WebDAV. There are no concepts of "appending" or "locking" data within Cloud Files (which may affect some disk mirroring or backup solutions), nor support for permissions or transcoding. Data is organised into "containers" but it is not possible to create nested folders without a translation layer. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working on a school project with your friend. Your friend uses "print" to debug his code. Is this a good idea and, regardless of whether it is bad or not, is there a better way to do it? Explain why or why not in max 2 sentences. | Print debugging is making use of print statements in order to find and isolate bugs in a program. It can be used to track the flow of data values of a piece of code. This type of debug code has some distinct disadvantages. It is temporary and usually removed when the bug is solved. The use of many print statements can affect the actual output of a program and slow down the run-time, depending on how often print statements are called. In some cases print statements do not help find the problem, for example the C++ stdout has a buffered output, and sometimes the contents of the buffer are lost leading to incorrect debugging information. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working on a school project with your friend. Your friend uses "print" to debug his code. Is this a good idea and, regardless of whether it is bad or not, is there a better way to do it? Explain why or why not in max 2 sentences. | A usage statement is not an error message, but is often used as a lazy way to avoid printing a useful error message. A usage statement should only be printed when specifically requested by the user (via --help, or -h, or -?, or some similar flag or argument) and should be written to the standard output; if the user has entered an incorrect command line, a properly written command line program will print a succinct error message that describes the exact error made by the user rather than printing the usage statement and requiring the user to figure out what the mistake was. If the user fails to pass the correct number of arguments, for example, a single line stating that an argument is missing is far more useful than several pages of output providing a general usage. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume that while working on a new feature for your team's product, your colleague is required to write a function that takes a list of events and sorts them by their timestamp. Using their algorithm course knowledge, they remind you that merge sort's complexity is $O(n log n)$, which is better than the $O(n^2)$ worst-case complexity of quick sort, and that they will therefore use the former to solve their task. What do you think of your colleague's approach? | In the worst case, merge sort uses approximately 39% fewer comparisons than quicksort does in its average case, and in terms of moves, merge sort's worst case complexity is O(n log n) - the same complexity as quicksort's best case.Merge sort is more efficient than quicksort for some types of lists if the data to be sorted can only be efficiently accessed sequentially, and is thus popular in languages such as Lisp, where sequentially accessed data structures are very common. Unlike some (efficient) implementations of quicksort, merge sort is a stable sort. Merge sort's most common implementation does not sort in place; therefore, the memory size of the input must be allocated for the sorted output to be stored in (see below for variations that need only n/2 extra spaces). | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume that while working on a new feature for your team's product, your colleague is required to write a function that takes a list of events and sorts them by their timestamp. Using their algorithm course knowledge, they remind you that merge sort's complexity is $O(n log n)$, which is better than the $O(n^2)$ worst-case complexity of quick sort, and that they will therefore use the former to solve their task. What do you think of your colleague's approach? | In sorting n objects, merge sort has an average and worst-case performance of O(n log n). If the running time of merge sort for a list of length n is T(n), then the recurrence relation T(n) = 2T(n/2) + n follows from the definition of the algorithm (apply the algorithm to two lists of half the size of the original list, and add the n steps taken to merge the resulting two lists). The closed form follows from the master theorem for divide-and-conquer recurrences. The number of comparisons made by merge sort in the worst case is given by the sorting numbers. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you decide to contribute to an open source project, by adding a feature to an existing class of the project. The class uses an underscore at the beginning of names then "camelCase" for private properties such as "_likeThis", but you find this odd because you're used to the "snake case" "like_this". Which option would you choose for the name of the new private property that you will add? | Python and Ruby both recommend UpperCamelCase for class names, CAPITALIZED_WITH_UNDERSCORES for constants, and snake_case for other names. In Python, if a name is intended to be "private", it is prefixed by one or two underscores. Private variables are enforced in Python only by convention. Names can also be suffixed with an underscore to prevent conflict with Python keywords. Prefixing with double underscores changes behaviour in classes with regard to name mangling. Prefixing and suffixing with double underscores - the so-called "dunder" ("double under") methods in Python - are reserved for "magic names" which fulfill special behaviour in Python objects. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you decide to contribute to an open source project, by adding a feature to an existing class of the project. The class uses an underscore at the beginning of names then "camelCase" for private properties such as "_likeThis", but you find this odd because you're used to the "snake case" "like_this". Which option would you choose for the name of the new private property that you will add? | Snake case (stylized as snake_case) is the style of writing in which each space is replaced with an underscore (_) character, and the first letter of each word is written in lowercase. It is a commonly used naming convention in computing, for example for variable and subroutine names, and for filenames. One study has found that readers can recognize snake case values more quickly than camel case. However, "subjects were trained mainly in the underscore style", so the possibility of bias cannot be eliminated. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working on SuperQuiz, a trendy app that lets everyone design quizzes and share them with friends! SuperQuiz recently hired a new CEO, who wants to improve the development practices using modern methods. However, this CEO has no engineering background, so the suggested improvements are well intentioned but not always feasible. The latest CEO suggestion is this:
"Continuous Integration is a modern best practice. We must adopt it, so that the code in our repository never has bugs. From now on, all branches in the SuperQuiz repository must have continuous integration enabled, and at the end of each day all branches must pass all tests."
Give two reasons (1 sentence each) explaining why the goal and implementation of the CEO's suggestion goes too far: | Continuous integration is intended to produce benefits such as: Integration bugs are detected early and are easy to track down due to small changesets. This saves both time and money over the lifespan of a project. Avoids last-minute chaos at release dates, when everyone tries to check in their slightly incompatible versions When unit tests fail or a bug emerges, if developers need to revert the codebase to a bug-free state without debugging, only a small number of changes are lost (because integration happens frequently) Constant availability of a "current" build for testing, demo, or release purposes Frequent code check-in pushes developers to create modular, less complex codeWith continuous automated testing, benefits can include: Enforces discipline of frequent automated testing Immediate feedback on the system-wide impact of local changes Software metrics generated from automated testing and CI (such as metrics for code coverage, code complexity, and feature completeness) focus developers on developing functional, quality code, and help develop momentum in a teamSome downsides of continuous integration can include: Constructing an automated test suite requires a considerable amount of work, including ongoing effort to cover new features and follow intentional code modifications. Testing is considered a best practice for software development in its own right, regardless of whether or not continuous integration is employed, and automation is an integral part of project methodologies like test-driven development. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working on SuperQuiz, a trendy app that lets everyone design quizzes and share them with friends! SuperQuiz recently hired a new CEO, who wants to improve the development practices using modern methods. However, this CEO has no engineering background, so the suggested improvements are well intentioned but not always feasible. The latest CEO suggestion is this:
"Continuous Integration is a modern best practice. We must adopt it, so that the code in our repository never has bugs. From now on, all branches in the SuperQuiz repository must have continuous integration enabled, and at the end of each day all branches must pass all tests."
Give two reasons (1 sentence each) explaining why the goal and implementation of the CEO's suggestion goes too far: | This section lists best practices suggested by various authors on how to achieve continuous integration, and how to automate this practice. Build automation is a best practice itself.Continuous integration—the practice of frequently integrating one's new or changed code with the existing code repository —should occur frequently enough that no intervening window remains between commit and build, and such that no errors can arise without developers noticing them and correcting them immediately. Normal practice is to trigger these builds by every commit to a repository, rather than a periodically scheduled build. The practicalities of doing this in a multi-developer environment of rapid commits are such that it is usual to trigger a short time after each commit, then to start a build when either this timer expires or after a rather longer interval since the last build. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Your colleague wants your opinion on a module design question. They are developing a service that recommends hikes near users based on the weather, and they think the module should take as input a weather service, a service that lists hikes, a function that sorts hikes by length, and outputs an array of hikes.
What do you think? (the answer should make it possible to have automated tests for the module) | This starts by being able to navigate. Another part is the weather, being able to read the weather, having gathered the latest and longer predictions before a hike, and possibly having a weather radio for updates. Being able to see further (binoculars) and record what is seen maybe additional equipment in this area. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Your colleague wants your opinion on a module design question. They are developing a service that recommends hikes near users based on the weather, and they think the module should take as input a weather service, a service that lists hikes, a function that sorts hikes by length, and outputs an array of hikes.
What do you think? (the answer should make it possible to have automated tests for the module) | Then the bulk of effort concentrates on writing the proper mediator code that will transform predicates on weather into a query over the weather website. This effort can become complex if some other source also relates to weather, because the designer may need to write code to properly combine the results from the two sources. On the other hand, in LAV, the source database is modeled as a set of views over G {\displaystyle G} . | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Imagine you're working at JaaS, the Jokes-as-a-Service platform. With JaaS, everyone can be funny any time by having new jokes at their fingertips via a public API.
During the orientation at JaaS, the VP of engineering explains to you their workflow:
1. Branching: Developers must use a separate branch for each feature, and they must commit their code once a day.
2. Testing: When their feature is finished, developers must run a test suite locally, on their machine, and make sure that every test passes. Once that's done, they can commit and push, then open a PR describing the feature, with a screenshot of the test results attached, and wait for code reviews from colleagues.
3. Merging: If no one requested changes on the code within 24 hours, one can merge the PR to the main branch.
The above "Branching" directive contains a flaw. Give a better alternative for it and explain why your alternative is better in maximum 2 sentences: | Patterns such as feature toggles can be very useful for committing code early which is not yet ready for use by end users. Using NoSQL can eliminate the step of data migrations and schema changes, often manual steps or exceptions to a continuous delivery workflow. Other useful techniques for developing code in isolation such as code branching are not obsolete in a CD world, but must be adapted to fit the principles of CD - for example, running multiple long-lived code branches can prove impractical, as a releasable artifact must be built early in the CD process from a single code branch if it is to pass through all phases of the pipeline. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Imagine you're working at JaaS, the Jokes-as-a-Service platform. With JaaS, everyone can be funny any time by having new jokes at their fingertips via a public API.
During the orientation at JaaS, the VP of engineering explains to you their workflow:
1. Branching: Developers must use a separate branch for each feature, and they must commit their code once a day.
2. Testing: When their feature is finished, developers must run a test suite locally, on their machine, and make sure that every test passes. Once that's done, they can commit and push, then open a PR describing the feature, with a screenshot of the test results attached, and wait for code reviews from colleagues.
3. Merging: If no one requested changes on the code within 24 hours, one can merge the PR to the main branch.
The above "Branching" directive contains a flaw. Give a better alternative for it and explain why your alternative is better in maximum 2 sentences: | Branching code is a normal part of large-team software development, allowing parallel development on both branches and hence, shorter development cycles. Classical branching has the following qualities: Is managed by a version control system that supports branching Branches are re-merged once parallel development is completed.Copy and paste is a less formal alternative to classical branching, often used when it is foreseen that the branches will diverge more and more over time, as when a new product is being spun off from an existing product. As a way of spinning-off a new product, copy-and-paste programming has some advantages. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume your team is considering adding support for the SwengPhotos cloud service, which provides upload and download of photos on private cloud storage. Each photo is associated with a unique name. SwengPhotos's documentation for the "upload new photo" interface describes the following error responses:
1. I/O error
2. Backend timeout error
3. Name already exists error
You decide to build a Java library to wrap the SwengPhotos API. For each error, explain in 1 sentence whether it should be a "checked" exception and why: | However, the "title" attribute of the "img" element specifies the internal entity "example1SVGTitle" whose declaration that does not define an annotation, so it is parsed by validating parsers and the entity replacement text is "Title of example1.svg". The content of the "img" element references another external entity "example1SVG" whose declaration also does not define an notation, so it is also parsed by validating parsers and the entity replacement text is located by its defined SYSTEM identifier "example1.svg" (also interpreted as a relative URI). The effective content for the "img" element be the content of this second external resource. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume your team is considering adding support for the SwengPhotos cloud service, which provides upload and download of photos on private cloud storage. Each photo is associated with a unique name. SwengPhotos's documentation for the "upload new photo" interface describes the following error responses:
1. I/O error
2. Backend timeout error
3. Name already exists error
You decide to build a Java library to wrap the SwengPhotos API. For each error, explain in 1 sentence whether it should be a "checked" exception and why: | Add to Quick Launch is a new context menu command for application shortcuts. Adornments now appear in the Shell for photos and videos; photos have instant camera paper photograph borders and videos have film reels. An error message ("The specified device name is invalid") now appears when the user attempts to use a reserved name for a folder or file. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Your colleague wants to improve the performance of a web application by caching common results in an in-memory LRU cache, where the least recently used results are evicted when the cache is full, and wants your opinion on the best way to implement it. He has already implemented the "Cache" interface, which he will use to store the cached results. The "Cache" interface is defined as follows:
interface Cache<K, V> {
/**
* Returns the value associated with the given key, or null if the key is not
* present in the cache.
*/
CompletableFuture<V> get(K key);
/**
* Associates the given value with the given key in the cache. If the cache
* already contains a value for the given key, it is replaced.
*/
CompletableFuture<Void> put(K key, V value);
}
What do you think of this interface? | Caching is a fundamental method of removing performance bottlenecks that are the result of slow access to data. Caching improves performance by retaining frequently used information in high speed memory, reducing access time and avoiding repeated computation. Caching is an effective manner of improving performance in situations where the principle of locality of reference applies. The methods used to determine which data is stored in progressively faster storage are collectively called caching strategies. Examples are ASP.NET cache, CPU cache, etc. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Your colleague wants to improve the performance of a web application by caching common results in an in-memory LRU cache, where the least recently used results are evicted when the cache is full, and wants your opinion on the best way to implement it. He has already implemented the "Cache" interface, which he will use to store the cached results. The "Cache" interface is defined as follows:
interface Cache<K, V> {
/**
* Returns the value associated with the given key, or null if the key is not
* present in the cache.
*/
CompletableFuture<V> get(K key);
/**
* Associates the given value with the given key in the cache. If the cache
* already contains a value for the given key, it is replaced.
*/
CompletableFuture<Void> put(K key, V value);
}
What do you think of this interface? | If each location in the main memory can be cached in either of two locations in the cache, one logical question is: which one of the two? The simplest and most commonly used scheme, shown in the right-hand diagram above, is to use the least significant bits of the memory location's index as the index for the cache memory, and to have two entries for each index. One benefit of this scheme is that the tags stored in the cache do not have to include that part of the main memory address which is implied by the cache memory's index. Since the cache tags have fewer bits, they require fewer transistors, take less space on the processor circuit board or on the microprocessor chip, and can be read and compared faster. Also LRU is especially simple since only one bit needs to be stored for each pair. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working on a text editor written in Java. Your colleague is interested in optimizing a wrapper around "String.substring()" used to let users copy and paste parts of the text and decides to write some benchmarks to measure the current performance of the feature. How would you suggest that he proceeds? | String interning speeds up string comparisons, which are sometimes a performance bottleneck in applications (such as compilers and dynamic programming language runtimes) that rely heavily on associative arrays with string keys to look up the attributes and methods of an object. Without interning, comparing two distinct strings may involve examining every character of both. This is slow for several reasons: it is inherently O(n) in the length of the strings; it typically requires reads from several regions of memory, which take time; and the reads fill up the processor cache, meaning there is less cache available for other needs. With interned strings, a simple object identity test suffices after the original intern operation; this is typically implemented as a pointer equality test, normally just a single machine instruction with no memory reference at all. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working on a text editor written in Java. Your colleague is interested in optimizing a wrapper around "String.substring()" used to let users copy and paste parts of the text and decides to write some benchmarks to measure the current performance of the feature. How would you suggest that he proceeds? | It is also possible to optimize the string represented using techniques from run length encoding (replacing repeated characters by the character value and a length) and Hamming encoding. While these representations are common, others are possible. Using ropes makes certain string operations, such as insertions, deletions, and concatenations more efficient. The core data structure in a text editor is the one that manages the string (sequence of characters) that represents the current state of the file being edited. While that state could be stored in a single long consecutive array of characters, a typical text editor instead uses an alternative representation as its sequence data structure—a gap buffer, a linked list of lines, a piece table, or a rope—which makes certain string operations, such as insertions, deletions, and undoing previous edits, more efficient. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
You just started an internship in an IT services company.
Your first task is about maintaining an old version of a product still used by a large customer. A bug just got fixed in the latest version of the product, and you must fix it in the old version. You ask where the source code is, and a developer shows you a repository in which the development team makes a single commit each week with the week's work. The old version is in another repository, which is a copy of the original repository made back when the version was released.
Suggest a better way to handle old versions, | When developers submit code to the repository they must first update their code to reflect the changes in the repository since they took their copy. The more changes the repository contains, the more work developers must do before submitting their own changes. Eventually, the repository may become so different from the developers' baselines that they enter what is sometimes referred to as "merge hell", or "integration hell", where the time it takes to integrate exceeds the time it took to make their original changes. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
You just started an internship in an IT services company.
Your first task is about maintaining an old version of a product still used by a large customer. A bug just got fixed in the latest version of the product, and you must fix it in the old version. You ask where the source code is, and a developer shows you a repository in which the development team makes a single commit each week with the week's work. The old version is in another repository, which is a copy of the original repository made back when the version was released.
Suggest a better way to handle old versions, | The development team should always be working on the latest version of the software. Since different team members may have versions saved locally with various changes and improvements, they should try to upload their current version to the code repository every few hours, or when a significant break presents itself. Continuous integration will avoid delays later on in the project cycle, caused by integration problems. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you're working for a startup that develops a university management app. You just received a description of what the app should do:
> This app will be the administrative backbone of the university.
> Almost all staff will use it.
> Human Resources will register each student, including their personal details, and use the system to ensure each student follows the rules concerning the duration of studies, the number of courses that must be taken, the payment of all applicable fees...
> Professors will use the app to input grades and to send informational messages to students in their courses.
> Students will be able to see the list of courses, register for a course, and see their grades.
> Staff members will also be able to update their personal details, including their banking coordinates for their salary.
Write a user story, in a single sentence using the below format, that summarizes this conversation:
> As a professor, I want to ... so that ...
Your story must contain all necessary information and only that information. | A university can obtain information regarding students' needs in numerous ways. It might create feedback section in its website. It could organize alumni panels or academic affairs to attract prospective students and collect concrete questions they are interested in. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you're working for a startup that develops a university management app. You just received a description of what the app should do:
> This app will be the administrative backbone of the university.
> Almost all staff will use it.
> Human Resources will register each student, including their personal details, and use the system to ensure each student follows the rules concerning the duration of studies, the number of courses that must be taken, the payment of all applicable fees...
> Professors will use the app to input grades and to send informational messages to students in their courses.
> Students will be able to see the list of courses, register for a course, and see their grades.
> Staff members will also be able to update their personal details, including their banking coordinates for their salary.
Write a user story, in a single sentence using the below format, that summarizes this conversation:
> As a professor, I want to ... so that ...
Your story must contain all necessary information and only that information. | Their aim is to help students in a specific field of study. To do so, they build up a user model where they store information about abilities, knowledge and needs of the user. The system can now adapt to this user by presenting appropriate exercises and examples and offering hints and help where the user is most likely to need them. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume In the process of reworking the architecture of the project, you need to remove a method because it's too easy to use incorrectly and there's now an easier-to-use replacement. What changes should you make for upcoming releases? | The problem being addressed by Meyer involves the maintenance of large software projects or software libraries. Sometimes when developing or maintaining software it is necessary, after much code is in place, to change a class or object in a way that transforms what was simply an attribute access into a method call. Programming languages often use different syntax for attribute access and invoking a method, (e.g., object.something versus object.something()). The syntax change would require, in popular programming languages of the day, changing the source code in all the places where the attribute was used. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume In the process of reworking the architecture of the project, you need to remove a method because it's too easy to use incorrectly and there's now an easier-to-use replacement. What changes should you make for upcoming releases? | This, however, suggests that the method is trying to do far too much and would be better broken into multiple methods, each of which is responsible for a smaller piece of the overall responsibility. This beckons as another opportunity for refactoring to be used in order to improve the quality of the code. Refactoring to eliminate data clumps does not need to be done by hand. Many modern fully featured IDEs have functionality (often labeled as "Extract Class") that is capable of performing this refactoring automatically or nearly so. This can decrease the cost and improve the reliability of the refactoring, thus enabling otherwise reluctant developers to do so expediently. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Your team is developing a library that is mostly intended to be used by your company's own applications, but the library is nevertheless distributed via a public repo on GitHub. It contains the following java function:
"public InputStream convertToPdf(Document document) throws GoogleServerNotRespondingError"
This library has a maintainability problem. Explain in 1-2 sentences what it is: | The whole problem collapses if the source code of the libraries is available. Then a simple recompilation will do the trick. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Your team is developing a library that is mostly intended to be used by your company's own applications, but the library is nevertheless distributed via a public repo on GitHub. It contains the following java function:
"public InputStream convertToPdf(Document document) throws GoogleServerNotRespondingError"
This library has a maintainability problem. Explain in 1-2 sentences what it is: | Frequently, in a distributed team, each developer has write access to their own public repository and they have read access to everyone else’s. There is also a dedicated repository, the blessed repository, which contains the "reference" version of the project source code. To contribute to this, developers create their own public clone of the project and push their changes to those. Then, they request one or more maintainers of the blessed repository to pull in their changes. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume that you are part of a team developing a mobile app using Scrum. One of your colleagues suggests that your team should organize daily Scrum meetings to discuss the progress of the tasks and how to implement complex features. He especially wants to discuss the implementation of a feature that will allow users to scan a QR code to get a discount, and would like some input from the team. What are your thoughts on this? | Scrum has daily meetings (the daily scrum) for the team to reflect and assess progress towards the sprint goal. This meeting is intended to be brief – less than 15 minutes – so any in-depth discussions about impediments are deferred until after the event is complete. As some teams conduct their meetings standing up, they may refer to this event as the "daily standup" The older Scrum Guide (2017) suggested team members briefly (a maximum of one minute per team member) address three questions as input to this planning: What did I do yesterday that helped the development team meet the sprint goal? | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume that you are part of a team developing a mobile app using Scrum. One of your colleagues suggests that your team should organize daily Scrum meetings to discuss the progress of the tasks and how to implement complex features. He especially wants to discuss the implementation of a feature that will allow users to scan a QR code to get a discount, and would like some input from the team. What are your thoughts on this? | Each day during a sprint, the developers hold a daily scrum (often conducted standing up) with specific guidelines, and which may be facilitated by a scrum master. Daily scrum meetings are intended to be less than 15 minutes in length, taking place at the same time and location daily. The purpose of the meeting is to announce progress made towards the sprint goal and issues that may be hindering the goal, without going into any detailed discussion. Once over, individual members can go into a 'breakout session' or an 'after party' for extended discussion and collaboration. Scrum masters are responsible for ensuring that team members use daily scrums effectively, or, if team members are unable to use them, to provide alternatives to achieve similar outcomes. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working on SuperQuiz, a trendy app that lets everyone design quizzes and share them with friends! SuperQuiz recently hired a new CEO, who wants to improve the development practices using modern methods. However, this CEO has no engineering background, so the suggested improvements are well intentioned but not always feasible. The latest CEO suggestion is this:
"Continuous Integration is a modern best practice. We must adopt it, so that the code in our repository never has bugs. From now on, all branches in the SuperQuiz repository must have continuous integration enabled, and at the end of each day all branches must pass all tests."
Propose (in 1-2 sentences) a compromise that achieves the CEO's true objective: | This section lists best practices suggested by various authors on how to achieve continuous integration, and how to automate this practice. Build automation is a best practice itself.Continuous integration—the practice of frequently integrating one's new or changed code with the existing code repository —should occur frequently enough that no intervening window remains between commit and build, and such that no errors can arise without developers noticing them and correcting them immediately. Normal practice is to trigger these builds by every commit to a repository, rather than a periodically scheduled build. The practicalities of doing this in a multi-developer environment of rapid commits are such that it is usual to trigger a short time after each commit, then to start a build when either this timer expires or after a rather longer interval since the last build. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working on SuperQuiz, a trendy app that lets everyone design quizzes and share them with friends! SuperQuiz recently hired a new CEO, who wants to improve the development practices using modern methods. However, this CEO has no engineering background, so the suggested improvements are well intentioned but not always feasible. The latest CEO suggestion is this:
"Continuous Integration is a modern best practice. We must adopt it, so that the code in our repository never has bugs. From now on, all branches in the SuperQuiz repository must have continuous integration enabled, and at the end of each day all branches must pass all tests."
Propose (in 1-2 sentences) a compromise that achieves the CEO's true objective: | Although daily builds were considered a best practice of software development in the 1990s, they have now been superseded. Continuous integration is now run on an almost continual basis, with a typical cycle time of around 20-30 minutes since the last change to the source code. Continuous integration servers continually monitor the source code control system. When these servers detect new changes, they use a build tool to rebuild the software. Good practice today is also to use continuous integration as part of continuous testing, so that unit tests are re-run for each build, and more extensive functional testing (which takes longer to perform than the build) performed as frequently as its duration permits. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume that some of your colleagues work on an AI-based image generation service, where a user enters a topic, and the AI generates a synthetic photo on that topic. They tell you the following about this service:
"Currently, the user types in the topic they want to see images for, and the client app sends a request to the server with the user ID and the indicated topic. The server generates an image, which takes a second or so, and sends it to the client app, which then requests another image on the same topic, and so on, until the app has received 9 images. It then displays these in a 3x3 grid. The user now looks at the 9 images and, if they see an inappropriate one, they click on a button that causes the app to send a review request to the server. Human moderators then process each report, and data scientists tweak the AI model to avoid generating images similar to the ones reported as inappropriate. Users then get a notification that their report was processed. The whole reporting process typically takes a day."
Now assume you can change the server's interface. Explain in 1-2 sentences an alternative way to make the app display the 9 images faster: | The new service is less like a game. The user picks a category and they are shown a set of images. They go through each image and state whether it has been correctly categorised. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume that some of your colleagues work on an AI-based image generation service, where a user enters a topic, and the AI generates a synthetic photo on that topic. They tell you the following about this service:
"Currently, the user types in the topic they want to see images for, and the client app sends a request to the server with the user ID and the indicated topic. The server generates an image, which takes a second or so, and sends it to the client app, which then requests another image on the same topic, and so on, until the app has received 9 images. It then displays these in a 3x3 grid. The user now looks at the 9 images and, if they see an inappropriate one, they click on a button that causes the app to send a review request to the server. Human moderators then process each report, and data scientists tweak the AI model to avoid generating images similar to the ones reported as inappropriate. Users then get a notification that their report was processed. The whole reporting process typically takes a day."
Now assume you can change the server's interface. Explain in 1-2 sentences an alternative way to make the app display the 9 images faster: | Generally, the user can set the input, and the input content includes detailed picture content that the user wants. For example, the content can be a scene's content, characters, weather, character relationships, specific items, etc. It can also include selecting a specific artist style, screen style, image pixel size, brightness, etc. Then picture generators will return several similar pictures generated according to the input (generally, 4 pictures are given now). After receiving the results generated by picture generators, the user can select one picture as a result he wants or let the generator redraw and return to new pictures. In addition, it is worth mentioning the whole process: it is also similar to the "generator" and "discriminator" modules in GANs. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
One of your colleagues has recently taken over responsibility for a legacy codebase, a library currently used by some of your customers. Before making functional changes, your colleague found a bug caused by incorrect use of the following method in the codebase:
public class User {
/** Indicates whether the user’s browser, if any, has JavaScript enabled. */
public boolean hasJavascriptEnabled() { … }
// … other methods, such as getName(), getAge(), ...
}
Your colleague believes that this is a bad API. You are reviewing the pull request your colleague made to fix this bug. After some discussion and additional commits to address feedback, the pull request is ready. You can either "squash" the pull request into a single commit, or leave the multiple commits as they are. Explain in 1 sentence whether you should "squash" and why. | Contributions to a source code repository that uses a distributed version control system are commonly made by means of a pull request, also known as a merge request. The contributor requests that the project maintainer pull the source code change, hence the name "pull request". The maintainer has to merge the pull request if the contribution should become part of the source base.The developer creates a pull request to notify maintainers of a new change; a comment thread is associated with each pull request. This allows for focused discussion of code changes. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
One of your colleagues has recently taken over responsibility for a legacy codebase, a library currently used by some of your customers. Before making functional changes, your colleague found a bug caused by incorrect use of the following method in the codebase:
public class User {
/** Indicates whether the user’s browser, if any, has JavaScript enabled. */
public boolean hasJavascriptEnabled() { … }
// … other methods, such as getName(), getAge(), ...
}
Your colleague believes that this is a bad API. You are reviewing the pull request your colleague made to fix this bug. After some discussion and additional commits to address feedback, the pull request is ready. You can either "squash" the pull request into a single commit, or leave the multiple commits as they are. Explain in 1 sentence whether you should "squash" and why. | This becomes critical if some functional changes are also made as a reviewer may simply not see the functional changes.If only atomic commits are made then commits that introduce errors become much simpler to identify. One need not look through every commit to see if it was the cause of the error, only the commits dealing with that functionality need to be examined. If the error is to be rolled back, atomic commits again make the job much simpler. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working on a mobile application. Users report that your app freezes when they access its image gallery, which shows images in a scrollable grid. This is the (java) function run to display the gallery:
void startImageGallery() {
// Download all the user's images from the application server
List<Image> images = getImages();
// Display the first few images
displayImage(images);
// Initialize the behavior of the exit button, back button, zoom button, etc.
startComponentBehavior();
}
In one sentence, explain why the application is freezing: | This method has several disadvantages, the most notable being that the entire system must be suspended during collection; no mutation of the working set can be allowed. This can cause programs to 'freeze' periodically (and generally unpredictably), making some real-time and time-critical applications impossible. In addition, the entire working memory must be examined, much of it twice, potentially causing problems in paged memory systems. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working on a mobile application. Users report that your app freezes when they access its image gallery, which shows images in a scrollable grid. This is the (java) function run to display the gallery:
void startImageGallery() {
// Download all the user's images from the application server
List<Image> images = getImages();
// Display the first few images
displayImage(images);
// Initialize the behavior of the exit button, back button, zoom button, etc.
startComponentBehavior();
}
In one sentence, explain why the application is freezing: | Does the application hang and freeze or does it fail gracefully? On restart, is it able to recover from the last good state? Does the system output meaningful error messages to the user and to the logs? Is the security of the system compromised because of unexpected failures? | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working on a trendy app that allows everyone to create and share quizzes! Your first task is to add a new feature. Here is a transcript from part of a conversation with a user:
> Hey! So you're the developer of this quiz app?
> The one where I can write questions and answers for my friends?
> I think it's cool, but I can't use it as much as I want to.
> I'm a firefighter, I don't have time for this app during the day,
> and when I come home, I have plenty to do, cook, clean, ...
> When I do these tasks I'm busy, not like when I'm watching TV.
> I don't always have my phone in hand! Sometimes I even forget where I put it.
> Maybe if one could use the app with voice it would work?
> With that, I could create quizzes while cooking!
> Otherwise, I can't use the app much.
Write a user story, in a single sentence using the below format, that summarizes this conversation:
> As a ... I want to ... So that ...
Your story must contain all necessary information and only that information. | Screening quiz (epic story) As the HR manager, I want to create a screening quiz so that I can understand whether I want to send possible recruits to the functional manager.Quiz recall As a manager, I want to browse my existing quizzes so I can recall what I have in place and figure out if I can just reuse or update an existing quiz for the position I need now.Limited backup As a user, I can indicate folders not to back up so that my backup drive is not filled up with things I do not need to be saved. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working on a trendy app that allows everyone to create and share quizzes! Your first task is to add a new feature. Here is a transcript from part of a conversation with a user:
> Hey! So you're the developer of this quiz app?
> The one where I can write questions and answers for my friends?
> I think it's cool, but I can't use it as much as I want to.
> I'm a firefighter, I don't have time for this app during the day,
> and when I come home, I have plenty to do, cook, clean, ...
> When I do these tasks I'm busy, not like when I'm watching TV.
> I don't always have my phone in hand! Sometimes I even forget where I put it.
> Maybe if one could use the app with voice it would work?
> With that, I could create quizzes while cooking!
> Otherwise, I can't use the app much.
Write a user story, in a single sentence using the below format, that summarizes this conversation:
> As a ... I want to ... So that ...
Your story must contain all necessary information and only that information. | Users started a game by choosing a topic of interest from over 1000 available official categories in addition to custom topics created by users.After the user picked a topic, they had the ability to either challenge a friend to a match or be paired against a random player. Users had the option of signing into the app through a social media platform such as Facebook, Twitter, or Google+ which allowed the user to see current friends who are using the app, invite friends to join them on the app, or challenge their friends to a game. Users also could choose to sign into QuizUp with an email address and not connect with a social media site. Players had the option of choosing to play with a friend or with a random stranger who may be in another country. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
A service is an application component that performs long-running operations, usually in the background. A service doesn't provide a UI.
While reviewing the pull request of a friend you notice that he periodically fetches data from the cloud in his activity? What potential problem this could lead to, and how can you fix it? | Generally, a service is an abstraction of computer resources and a client does not have to be concerned with how the server performs while fulfilling the request and delivering the response. The client only has to understand the response based on the well-known application protocol, i.e. the content and the formatting of the data for the requested service. Clients and servers exchange messages in a request–response messaging pattern. The client sends a request, and the server returns a response. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
A service is an application component that performs long-running operations, usually in the background. A service doesn't provide a UI.
While reviewing the pull request of a friend you notice that he periodically fetches data from the cloud in his activity? What potential problem this could lead to, and how can you fix it? | A service is a discrete unit of functionality that can be accessed remotely and acted upon and updated independently, such as retrieving a credit card statement online. The guideline describes how to measure the functional size of distinct components. Data WareHouse and Big Data is a field that treats ways to analyze, systematically extract information from, or otherwise deal with data sets that are too large or complex to be dealt with by traditional data-processing application software. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
You are writing an implementation for the following function:
/** Find the N-th percentile of the array of values provided, e.g., 50% = median, 100% = maximum */
int findPercentile(int[] values, int n)
To facilitate debugging, you decided to add a post-condition: the returned value must be in the array "values". However, one of your colleagues notices that the post-condition requires to iterate the whole array, and does not agree because this function will be used frequently in a code whose latency must be minimized. What compromise would you suggest? What are its pros and cons? | The following C++ code example is a simple implementation. At each stage it computes a probe position then as with the binary search, moves either the upper or lower bound in to define a smaller interval containing the sought value. Unlike the binary search which guarantees a halving of the interval's size with each stage, a misled interpolation may reduce/i-case efficiency of O(n). Notice that having probed the list at index mid, for reasons of loop control administration, this code sets either high or low to be not mid but an adjacent index, which location is then probed during the next iteration. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
You are writing an implementation for the following function:
/** Find the N-th percentile of the array of values provided, e.g., 50% = median, 100% = maximum */
int findPercentile(int[] values, int n)
To facilitate debugging, you decided to add a post-condition: the returned value must be in the array "values". However, one of your colleagues notices that the post-condition requires to iterate the whole array, and does not agree because this function will be used frequently in a code whose latency must be minimized. What compromise would you suggest? What are its pros and cons? | The result of the calculation is typically expressed as an integer rather than a percentage. The core How likely would you be to recommend... question is almost always accompanied by an open-ended "Why?" | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you have been working with a friend on a LinkedIn-like app, where a user can lookup the shortest path to another user on the platform. You currently have two issues, the operation of finding a path sometimes takes a considerable amount of time, and it freezes the app in the process. Your friend suggests to run this operation concurrently with the main thread, he says it's going to speed up the duration of the operation and will stop the freezes.
Your friend suggestion will actually only fix one of the two problems, can you tell which one is it and why? | Completing one's own operation is complicated by the possibility of concurrent assistance and abortion, but is invariably the fastest path to completion. The decision about when to assist, abort or wait when an obstruction is met is the responsibility of a contention manager. This may be very simple (assist higher priority operations, abort lower priority ones), or may be more optimized to achieve better throughput, or lower the latency of prioritized operations. Correct concurrent assistance is typically the most complex part of a lock-free algorithm, and often very costly to execute: not only does the assisting thread slow down, but thanks to the mechanics of shared memory, the thread being assisted will be slowed, too, if it is still running. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you have been working with a friend on a LinkedIn-like app, where a user can lookup the shortest path to another user on the platform. You currently have two issues, the operation of finding a path sometimes takes a considerable amount of time, and it freezes the app in the process. Your friend suggests to run this operation concurrently with the main thread, he says it's going to speed up the duration of the operation and will stop the freezes.
Your friend suggestion will actually only fix one of the two problems, can you tell which one is it and why? | Intensive calculations cause lengthy delays with the same effect as a blocked API call. There are two methods used to handle blocking. Threads TimersThreading allows a separate sequence of execution for each API call that can block. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working in a company on the back-end of a mobile application. You are tasked with improving the integration of the authentication via Google in your app, but your manager tells you:
"Don't run any tests today, we only have a few API calls left for today's rate limit, we need to preserve those for customers."
In 1-2 sentences, propose a change to the codebase to avoid this problem. | The original intention was that this code might be used as part of some form of digital cash or micropayment scheme, as proposed, for example, by GNU Taler, but that has not yet happened, and this code is not widely used. Google Developers API uses this status if a particular developer has exceeded the daily limit on requests. Sipgate uses this code if an account does not have sufficient funds to start a call. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are working in a company on the back-end of a mobile application. You are tasked with improving the integration of the authentication via Google in your app, but your manager tells you:
"Don't run any tests today, we only have a few API calls left for today's rate limit, we need to preserve those for customers."
In 1-2 sentences, propose a change to the codebase to avoid this problem. | Because the new development initiative does not touch the code of the existing product: There is no need to regression test the existing product, saving on QA time associated with the new product launch, and reducing time to market. There is no risk of introduced bugs in the existing product, which might upset the installed user base.The downsides are: If the new product does not diverge as much as anticipated from the existing product, two code bases might need to be supported (at twice the cost) where one would have done. This can lead to expensive refactoring and manual merging down the line. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are part of a team developing a mobile app using Scrum. At the last sprint planning, you were assigned the task of adding a new authentication method. However, a customer representative just sent you an email:
"the representative believes authentication is less important than support for right-to-left languages, and would like you to work on that instead."
Explain in 1 sentence what you should do: | In 2016, Visa criticised the proposal of making strong customer authentication mandatory, on the grounds that it could make online payments more difficult, and thus hurt sales at online retailers.In 2019, consumer representation group Which? noted that many UK banks were implementing SCA by requiring a phone capable of receiving a text message or push notification. When surveyed, nearly one in five Which? members were concerned that they may be unable to make payments if there was no alternative, either due to poor reception or not owning a phone.In 2020, an independent report conducted by consultancy firm CMSPI found that the potential disruption caused by strong customer authentication (excluding the United Kingdom) could be €108 billion in 2021. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Assume you are part of a team developing a mobile app using Scrum. At the last sprint planning, you were assigned the task of adding a new authentication method. However, a customer representative just sent you an email:
"the representative believes authentication is less important than support for right-to-left languages, and would like you to work on that instead."
Explain in 1 sentence what you should do: | With the widespread adoption of remote working during the COVID-19 pandemic and changes to tooling, more studies have been conducted around co-location and distributed working which show that co-location is increasingly less relevant. No matter which development method is followed, every team should include a customer representative (known as product owner in Scrum). This representative is agreed by stakeholders to act on their behalf and makes a personal commitment to being available for developers to answer questions throughout the iteration. At the end of each iteration, the project stakeholders together with the customer representative review progress and re-evaluate priorities with a view to optimizing the return on investment (ROI) and ensuring alignment with customer needs and company goals. The importance of stakeholder satisfaction, detailed by frequent interaction and review at the end of each phase, is why the approach is often denoted as a customer-centered methodology. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Given the following code snippet, you are tasked to produce a
modulo scheduled version of the loop achieving the best possible
performance. You can assume that any operation has a latency of one
cycle and that the processor has 2 ALUs, one memory unit, and one
branch unit. The processor also has all the necessary hardware
structures and instructions to support modulo scheduling. In
particular, the instruction erb+mov EC+ loads a value in the
epilogue counter and the instruction erb+loop.pip+ is equivalent
to erb+loop+ but has all features expected to execute a modulo
scheduled loop. Predicates from erb+p32+ and registers from
erb+x32+ onwards rotate; across iterations registers are rotated
upwards (i.e., the content of erb+x44+ is accessible as erb+x45+
in the next iteration). What is the shortest achievable initiation
interval? Why?
egin{verbatim}
0: mov LC, 100
1: mov x1, 10000
2: ld x2, 0(x1)
3: addi x2, x2, 10
4: st x2, 0(x1)
5: addi x1, x1, 1
6: loop 2
\end{verbatim}
| There are several types of instruction scheduling: Local (basic block) scheduling: instructions can't move across basic block boundaries. Global scheduling: instructions can move across basic block boundaries. Modulo scheduling: an algorithm for generating software pipelining, which is a way of increasing instruction level parallelism by interleaving different iterations of an inner loop. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Given the following code snippet, you are tasked to produce a
modulo scheduled version of the loop achieving the best possible
performance. You can assume that any operation has a latency of one
cycle and that the processor has 2 ALUs, one memory unit, and one
branch unit. The processor also has all the necessary hardware
structures and instructions to support modulo scheduling. In
particular, the instruction erb+mov EC+ loads a value in the
epilogue counter and the instruction erb+loop.pip+ is equivalent
to erb+loop+ but has all features expected to execute a modulo
scheduled loop. Predicates from erb+p32+ and registers from
erb+x32+ onwards rotate; across iterations registers are rotated
upwards (i.e., the content of erb+x44+ is accessible as erb+x45+
in the next iteration). What is the shortest achievable initiation
interval? Why?
egin{verbatim}
0: mov LC, 100
1: mov x1, 10000
2: ld x2, 0(x1)
3: addi x2, x2, 10
4: st x2, 0(x1)
5: addi x1, x1, 1
6: loop 2
\end{verbatim}
| However, let there be no dependence between operations for different values of i. In other words, A(2) can begin before A(1) finishes. Without software pipelining, the operations execute in the following sequence: A(1) B(1) C(1) A(2) B(2) C(2) A(3) B(3) C(3) ... Assume that each instruction takes 3 clock cycles to complete (ignore for the moment the cost of the looping control flow). Also assume (as is the case on most modern systems) that an instruction can be dispatched every cycle, as long as it has no dependencies on an instruction that is already executing. In the unpipelined case, each iteration thus takes 9 cycles to complete: 3 clock cycles for A(1), 3 clock cycles for B(1), and 3 clock cycles for C(1). Now consider the following sequence of instructions with software pipelining: A(1) A(2) A(3) B(1) B(2) B(3) C(1) C(2) C(3) ... It can be easily verified that an instruction can be dispatched each cycle, which means that the same 3 iterations can be executed in a total of 9 cycles, giving an average of 3 cycles per iteration. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Why a data prefetcher could hinder a Prime+Probe cache attack?
How can the attacker overcome this problem?
| Cache prefetching can either fetch data or instructions into cache. Data prefetching fetches data before it is needed. Because data access patterns show less regularity than instruction patterns, accurate data prefetching is generally more challenging than instruction prefetching. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Why a data prefetcher could hinder a Prime+Probe cache attack?
How can the attacker overcome this problem?
| A variant of prefetch for the instruction cache. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Describe the techniques that typical dynamically scheduled
processors use to achieve the same purpose of the following features
of Intel Itanium: (a) Predicated execution; (b) advanced
loads---that is, loads moved before a store and explicit check for
RAW hazards; (c) speculative loads---that is, loads moved before a
branch and explicit check for exceptions; (d) rotating register
file. | A check load instruction aids speculative loads by checking whether a speculative load was dependent on a later store, and thus must be reloaded.The EPIC architecture also includes a grab-bag of architectural concepts to increase ILP: Predicated execution is used to decrease the occurrence of branches and to increase the speculative execution of instructions. In this feature, branch conditions are converted to predicate registers which are used to kill results of executed instructions from the side of the branch which is not taken. Delayed exceptions, using a not a thing bit within the general purpose registers, allow speculative execution past possible exceptions. Very large architectural register files avoid the need for register renaming. Multi-way branch instructions improve branch prediction by combining many alternative branches into one bundle.The Itanium architecture also added rotating register files, a tool useful for software pipelining since it avoids having to manually unroll and rename registers. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Describe the techniques that typical dynamically scheduled
processors use to achieve the same purpose of the following features
of Intel Itanium: (a) Predicated execution; (b) advanced
loads---that is, loads moved before a store and explicit check for
RAW hazards; (c) speculative loads---that is, loads moved before a
branch and explicit check for exceptions; (d) rotating register
file. | Modern pipelined microprocessors use speculative execution to reduce the cost of conditional branch instructions using schemes that predict the execution path of a program based on the history of branch executions. In order to improve performance and utilization of computer resources, instructions can be scheduled at a time when it has not yet been determined that the instructions will need to be executed, ahead of a branch. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Consider the following code transformation:
egin{verbatim}
r3 = r3 << 4 r4 = r4 << 4
st [r3] = r2 ld r1 = [r4]
r5 = r3 + 4 r1 = r1 + 1
st [r5] = r6 => r3 = r3 << 4
r4 = r4 << 4 st [r3] = r2
ld r1 = [r4] r5 = r3 + 4
r1 = r1 + 1 st [r5] = r6
\end{verbatim}
Correct the code to avoid the problem(s) using the appropriate
Itanium instruction(s). Write also any needed recovery code. As much as possible, keep the new ordering (right snippet above). | We can use exactly the same methods that we have just used for the standard solution in the last section. We shall not (in the instance where γ = 4 {\displaystyle \gamma =4} ) replace a 0 {\displaystyle a_{0}} with b 0 ( c + 3 ) {\displaystyle b_{0}(c+3)} as this will not give us the standard form of solution that we are after. Rather, we shall ``insist" that A 3 = c o n s t . | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Consider the following code transformation:
egin{verbatim}
r3 = r3 << 4 r4 = r4 << 4
st [r3] = r2 ld r1 = [r4]
r5 = r3 + 4 r1 = r1 + 1
st [r5] = r6 => r3 = r3 << 4
r4 = r4 << 4 st [r3] = r2
ld r1 = [r4] r5 = r3 + 4
r1 = r1 + 1 st [r5] = r6
\end{verbatim}
Correct the code to avoid the problem(s) using the appropriate
Itanium instruction(s). Write also any needed recovery code. As much as possible, keep the new ordering (right snippet above). | Now, imagine that there are two bit-errors in the transmission, so the received codeword is . In polynomial notation: R ( x ) = C ( x ) + x 13 + x 5 = x 14 + x 11 + x 10 + x 9 + x 5 + x 4 + x 2 {\displaystyle R(x)=C(x)+x^{13}+x^{5}=x^{14}+x^{11}+x^{10}+x^{9}+x^{5}+x^{4}+x^{2}} In order to correct the errors, first calculate the syndromes. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
What are the differences between statically scheduled HLS and dynamically scheduled HLS?
| A real-time scheduling algorithm can be classified as static or dynamic. For a static scheduler, task priorities are determined before the system runs. A dynamic scheduler determines task priorities as it runs. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
What are the differences between statically scheduled HLS and dynamically scheduled HLS?
| This adds further complication to the multiprocessor scheduling problem. Static versus Dynamic: Machine scheduling algorithms are static or dynamic. A scheduling algorithm is static if the scheduling decisions as to what computational tasks will be allocated to what processors are made before running the program. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
How would a data prefetcher influence the results of a
\emph{prime + probe} attack? | The objective of the prefetch procedure is to prefetch data from NAND based on a given prediction graph such that most data accesses occur over SRAM. The basic idea is to prefetch data by following the LBA order in the graph. In order to efficiently look up a selected page in the cache, a cyclic queue is adopted in the cache management. Data prefetched from NAND flash is enqueued, while those transferred to the host is dequeued, on the other hand. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
How would a data prefetcher influence the results of a
\emph{prime + probe} attack? | It then goes on to show that the subsequent difference between cache hits and misses can be reliably timed, so that what should have been a simple non-functional difference can in fact be subverted into a covert channel which extracts information from an unrelated process's inner workings. Thirdly, the paper synthesizes the results with return-oriented programming exploits and other principles with a simple example program and a JavaScript snippet run under a sandboxing browser; in both cases, the entire address space of the victim process (i.e. the contents of a running program) is shown to be readable by simply exploiting speculative execution of conditional branches in code generated by a stock compiler or the JavaScript machinery present in an existing browser. The basic idea is to search existing code for places where speculation touches upon otherwise inaccessible data, manipulate the processor into a state where speculative execution has to contact that data, and then time the side effect of the processor being faster, if its by-now-prepared prefetch machinery indeed did load a cache line. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Can one easily adapt the Spectre attack to Itanium? If so, give
some hints on how different it will be from the classic attack and
how potential victims could protect sensitive parts of their code. If
not, explain why it is not possible.
| Other manufacturers' custom CPU cores implementing the ARM instruction set, such as those found in newer members of the Apple A series processors, have also been reported to be vulnerable. In general, higher-performance CPUs tend to have intensive speculative execution, making them vulnerable to Spectre.Spectre has the potential of having a greater impact on cloud providers than Meltdown. Whereas Meltdown allows unauthorized applications to read from privileged memory to obtain sensitive data from processes running on the same cloud server, Spectre can allow malicious programs to induce a hypervisor to transmit the data to a guest system running on top of it. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Can one easily adapt the Spectre attack to Itanium? If so, give
some hints on how different it will be from the classic attack and
how potential victims could protect sensitive parts of their code. If
not, explain why it is not possible.
| Since Spectre represents a whole class of attacks, most likely, there cannot be a single patch for it. While work is already being done to address special cases of the vulnerability, the original website devoted to Spectre and Meltdown states: "As is not easy to fix, it will haunt us for a long time." At the same time, according to Dell: "No 'real-world' exploits of these vulnerabilities have been reported to date , though researchers have produced proof-of-concepts. "Several procedures to help protect home computers and related devices from the vulnerability have been published. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
What is modulo scheduling and what are its benefits? What does
it apply to? What is its goal? In which respect is it superior to
simpler techniques with the same goal? | Lam showed that special hardware is unnecessary for effective modulo scheduling. Her technique, modulo variable expansion is widely used in practice. Gao et al. formulated optimal software pipelining in integer linear programming, culminating in validation of advanced heuristics in an evaluation paper. This paper has a good set of references on the topic. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
What is modulo scheduling and what are its benefits? What does
it apply to? What is its goal? In which respect is it superior to
simpler techniques with the same goal? | There are several types of instruction scheduling: Local (basic block) scheduling: instructions can't move across basic block boundaries. Global scheduling: instructions can move across basic block boundaries. Modulo scheduling: an algorithm for generating software pipelining, which is a way of increasing instruction level parallelism by interleaving different iterations of an inner loop. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
What is the function of processors in a reorder buffer? | Implementation of Peterson's and related algorithms on processors that reorder memory accesses generally requires use of such operations to work correctly to keep sequential operations from happening in an incorrect order. Note that reordering of memory accesses can happen even on processors that don't reorder instructions (such as the PowerPC processor in the Xbox 360).Most such CPUs also have some sort of guaranteed atomic operation, such as XCHG on x86 processors and load-link/store-conditional on Alpha, MIPS, PowerPC, and other architectures. These instructions are intended to provide a way to build synchronization primitives more efficiently than can be done with pure shared memory approaches. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
What is the function of processors in a reorder buffer? | Due to a store buffer, a load can access cache ahead of a preceding store.PowerPC 604 (1995) was the first single-chip processor with execution unit-level re-ordering, as three out of its six units each had a two-entry reservation station permitting the newer entry to execute before the older. The re-order buffer capacity is 16 instructions. A four-entry load queue and a six-entry store queue track the re-ordering of loads and stores upon cache misses. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Show a code snippet which represents the kernel of a Spectre
attack (use any convenient programming language or assembly).
| The Spectre attack could leverage the Linux kernel's eBPF interpreter or JIT compiler to extract data from other kernel processes. A JIT hardening feature in the kernel mitigates this vulnerability.Chinese computer security group Pangu Lab said the NSA used BPF to conceal network communications as part of a complex Linux backdoor. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Show a code snippet which represents the kernel of a Spectre
attack (use any convenient programming language or assembly).
| Although plain text is a fundamental feature included even with applications that support only non-programmable "static" snippets, programmable snippets are also used for working with plain text. One common complication, however, is that environments that support programmable snippets often have to make distinctions between what counts as "plain text" and what counts as "programming instructions". Further complicating this distinction is the fact that applications that support programmable snippets almost always include support for recognition of multiple programming languages, either through basic syntax highlighting or execution of embedded commands. For these and other reasons, emitting plain text from programmable snippets almost always entails being careful to avoid problems with syntax and delimiter collisions. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Consider the following snippet used to produce a
high-performance circuit using a statically scheduled HLS tool, such
as Xilinx Vivado HLS. Assume that a erb+double+ multiplication
takes several cycles (latency) to compute.
egin{verbatim}
double a[ARRAY_SIZE] = ...;
int b = 1;
for (int i = 0; i < ARRAY_SIZE; i++)
if (a[i] * (double) b >= CONST)
b++;
\end{verbatim}
Is this kind of code fundamentally problematic for a tool aimed at
producing statically scheduled pipelined circuits? If so, explain.
| In general, an algorithm can be performed over many clock cycles with few hardware resources, or over fewer clock cycles using a larger number of ALUs, registers and memories. Correspondingly, from one algorithmic description, a variety of hardware microarchitectures can be generated by an HLS compiler according to the directives given to the tool. This is the same trade off of execution speed for hardware complexity as seen when a given program is run on conventional processors of differing performance, yet all running at roughly the same clock frequency. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Consider the following snippet used to produce a
high-performance circuit using a statically scheduled HLS tool, such
as Xilinx Vivado HLS. Assume that a erb+double+ multiplication
takes several cycles (latency) to compute.
egin{verbatim}
double a[ARRAY_SIZE] = ...;
int b = 1;
for (int i = 0; i < ARRAY_SIZE; i++)
if (a[i] * (double) b >= CONST)
b++;
\end{verbatim}
Is this kind of code fundamentally problematic for a tool aimed at
producing statically scheduled pipelined circuits? If so, explain.
| There is some area overhead associated with this technique since the circuit designer needs to add extra circuitry, i.e. latches, at the inputs. Also, if the latches are being added in a pipeline stage, they might change the critical path, and hence increase the propagation delay and cycle time. In cases where the overhead is not acceptable, one can think of clock gating as an alternative method of low power design. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
With respect to reorder buffers, Would you expect to find the memory address where a particular
instruction was fetched (i.e., the value of the PC at the time of fetching) inside the reorder buffer? If so, why would it be there? If not, elaborate on why it would it be unneeded. | It differs from a history buffer because the reorder buffer typically comes after the future file (if it exists) and before the architectural register file. Reorder buffers can be data-less or data-ful. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
With respect to reorder buffers, Would you expect to find the memory address where a particular
instruction was fetched (i.e., the value of the PC at the time of fetching) inside the reorder buffer? If so, why would it be there? If not, elaborate on why it would it be unneeded. | Fetch involves retrieving an instruction (which is represented by a number or sequence of numbers) from program memory. The instruction's location (address) in program memory is determined by the program counter (PC; called the "instruction pointer" in Intel x86 microprocessors), which stores a number that identifies the address of the next instruction to be fetched. After an instruction is fetched, the PC is incremented by the length of the instruction so that it will contain the address of the next instruction in the sequence. Often, the instruction to be fetched must be retrieved from relatively slow memory, causing the CPU to stall while waiting for the instruction to be returned. This issue is largely addressed in modern processors by caches and pipeline architectures (see below). | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
The MIPS R10000 fetches four instructions at once and, therefore,
there are four such circuits working in parallel inside the processor. Describe very briefly the function of the ``FP map'', of the
``Floating-point queue'', and of the ``Active list''. If applicable,
feel free to describe them using other generic terms or names for
these structures used in the course. | The MIPS architecture supports up to four coprocessor units, used for memory management, floating-point arithmetic, and two undefined coprocessors for other tasks such as graphics accelerators. Using FPGA (field-programmable gate arrays), custom coprocessors can be created for acceleration of particular processing tasks such as digital signal processing (e.g. Zynq, combines ARM cores with FPGA on a single die). TLS/SSL accelerators, used on servers; such accelerators used to be cards, but in modern times are instructions for crypto in mainstream CPUs. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
The MIPS R10000 fetches four instructions at once and, therefore,
there are four such circuits working in parallel inside the processor. Describe very briefly the function of the ``FP map'', of the
``Floating-point queue'', and of the ``Active list''. If applicable,
feel free to describe them using other generic terms or names for
these structures used in the course. | To improve access to operands, an indexed addressing mode (base + index, both sourced from GPRs) for FP loads and stores was added, as were prefetch instructions for performing memory prefetching and specifying cache hints (these supported both the base + offset and base + index addressing modes). MIPS IV added several features to improve instruction-level parallelism. To alleviate the bottleneck caused by a single condition bit, seven condition code bits were added to the floating-point control and status register, bringing the total to eight. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
In Itanium's procedure call and return mechanism, Still ignoring potential problems during the execution of
erb+alloc+, what hardware changes are needed to the processor
(compared to a more traditional and straightforward VLIW processor)
to implement this functionality? | Intel's Itanium architecture (among others) solved the backward-compatibility problem with a more general mechanism. Within each of the multiple-opcode instructions, a bit field is allocated to denote dependency on the prior VLIW instruction within the program instruction stream. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
In Itanium's procedure call and return mechanism, Still ignoring potential problems during the execution of
erb+alloc+, what hardware changes are needed to the processor
(compared to a more traditional and straightforward VLIW processor)
to implement this functionality? | In January 2000, Transmeta Corporation took the novel step of placing a compiler in the central processing unit, and making the compiler translate from a reference byte code (in their case, x86 instructions) to an internal VLIW instruction set. This method combines the hardware simplicity, low power and speed of VLIW RISC with the compact main memory system and software reverse-compatibility provided by popular CISC. Intel's Itanium chip is based on what they call an explicitly parallel instruction computing (EPIC) design. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Consider a classic pipeline with Fetch, Decode, Execute, Memory,
and Writeback stages such as MIPS's. Give an example snippet made of
2-3 instructions (use any credible assembly language) which would
benefit from a forwarding path between the Memory and Execute stage
(assume that no other forwarding paths exist). | Let us assume a classic RISC pipeline, with the following five stages: Instruction fetch cycle (IF). Instruction decode/Register fetch cycle (ID). Execution/Effective address cycle (EX). Memory access (MEM). | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Consider a classic pipeline with Fetch, Decode, Execute, Memory,
and Writeback stages such as MIPS's. Give an example snippet made of
2-3 instructions (use any credible assembly language) which would
benefit from a forwarding path between the Memory and Execute stage
(assume that no other forwarding paths exist). | The number of dependent steps varies with the machine architecture. For example: The 1956–61 IBM Stretch project proposed the terms Fetch, Decode, and Execute that have become common. The classic RISC pipeline comprises: Instruction fetch Instruction decode and register fetch Execute Memory access Register write back The Atmel AVR and the PIC microcontroller each have a two-stage pipeline. Many designs include pipelines as long as 7, 10 and even 20 stages (as in the Intel Pentium 4). | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
What does it mean that a processor implements precise exceptions? | The program counter is set to the address of a special exception handler, and special registers are written with the exception location and cause. To make it easy (and fast) for the software to fix the problem and restart the program, the CPU must take a precise exception. A precise exception means that all instructions up to the excepting instruction have been executed, and the excepting instruction and everything afterwards have not been executed. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
What does it mean that a processor implements precise exceptions? | Practically speaking, there may be exceptions for which not enough status information about an exception is available, in which case the processor may raise a special exception, called an "imprecise" exception. Imprecise exceptions cannot occur in in-order implementations, as processor state is changed only in program order (see RISC Pipeline Exceptions). Programs that experience "precise" exceptions, where the specific instruction that took the exception can be determined, can restart or re-execute at the point of the exception. However, those that experience "imprecise" exceptions generally cannot restart or re-execute, as the system cannot determine the specific instruction that took the exception. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Consider the following code transformation:
egin{verbatim}
r3 = r3 << 4 r4 = r4 << 4
st [r3] = r2 ld r1 = [r4]
r5 = r3 + 4 r1 = r1 + 1
st [r5] = r6 => r3 = r3 << 4
r4 = r4 << 4 st [r3] = r2
ld r1 = [r4] r5 = r3 + 4
r1 = r1 + 1 st [r5] = r6
\end{verbatim}
Explain (i) which pairs of instructions which have been reordered in
the above snippets are potentially resulting in erroneous execution
in general and (ii) discuss specifically whether they are indeed a
problem in this specific case. | But they are semantically different. They need to be interpreted differently and treated differently and some kind of conversion function will need to be called if you assign one to the other or you will have a runtime bug. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Consider the following code transformation:
egin{verbatim}
r3 = r3 << 4 r4 = r4 << 4
st [r3] = r2 ld r1 = [r4]
r5 = r3 + 4 r1 = r1 + 1
st [r5] = r6 => r3 = r3 << 4
r4 = r4 << 4 st [r3] = r2
ld r1 = [r4] r5 = r3 + 4
r1 = r1 + 1 st [r5] = r6
\end{verbatim}
Explain (i) which pairs of instructions which have been reordered in
the above snippets are potentially resulting in erroneous execution
in general and (ii) discuss specifically whether they are indeed a
problem in this specific case. | Objections have been raised to both the syntax, how it's typed, and the semantics, how it works. While easy to type, an important factor for an interactive command processor, the syntax has been criticized as awkward to nest, putting one command substitution inside another, because both the left and the right delimiters are the same. The KornShell (ksh) solved this with an alternative notation, $( ... ), borrowing from the notational style used for variable substitution. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
What is predication and why is it (almost) universal in VLIW
processors? Could it make sense also in a RISC processor? Why? | In the Hewlett-Packard/Intel IA-64 architecture, most instructions are predicated. The predicates are stored in 64 special-purpose predicate registers; and one of the predicate registers is always true so that unpredicated instructions are simply instructions predicated with the value true. The use of predication is essential in IA-64's implementation of software pipelining because it avoids the need for writing separated code for prologs and epilogs.In the x86 architecture, a family of conditional move instructions (CMOV and FCMOV) were added to the architecture by the Intel Pentium Pro (1995) processor. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
What is predication and why is it (almost) universal in VLIW
processors? Could it make sense also in a RISC processor? Why? | However, some architectures such as Thumb-2 are able to avoid this issue (see below). Other detriments are the following: Predication complicates the hardware by adding levels of logic to critical paths and potentially degrades clock speed. A predicated block includes cycles for all operations, so shorter paths may take longer and be penalized. Predication is not usually speculated and causes a longer dependency chain. For ordered data this translates to a performance loss compared to a predictable branch.Predication is most effective when paths are balanced or when the longest path is the most frequently executed, but determining such a path is very difficult at compile time, even in the presence of profiling information. | https://www.kaggle.com/datasets/conjuring92/wiki-stem-corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.