Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added multiple questions #3186

Merged
merged 1 commit into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions c-(programming-language)/c-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -780,3 +780,19 @@ int main()
fibonacci(0,1);
}
```

#### Q48. Which is *not* a storage class specifier?

- [x] `intern`
- [ ] `extern`
- [ ] `register`
- [ ] `static`

[Reference](https://en.cppreference.com/w/cpp/language/storage_duration)

#### Q49. Which line of code, after execution, results in `i` having the value of 1?

- [ ] `for(i=1; i<=1; i++);`
- [ ] `for(i=1; i=10; i++);`
- [x] `for(i=1; i==10; i++);`
- [ ] `for(i=10; i>=1; i--);`
89 changes: 89 additions & 0 deletions jquery/jquery-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -1323,3 +1323,92 @@ $.fn.myTraverse = function() {

**.nextAll([selector]) method**
`Gets all following siblings of each element in the set of matched elements, optionally filtered by a selector.`

#### Q68. You have an element with a series of code (not CSS) animations applied to it that could be triggered by code you control, or other code elsewhere (such as plugins). How can you fire some code when all those animations have completed?

- [ ]

```js
$('#element').on('animationend', function() {
console.log('Finally, everything is done!')
});
```

- [ ]

```js
$('#element').on('promise').then(function() {
console.log('Finally, everything is done!')
});
```

- [ ]

```js
$('#element').promise().catch(function() {
console.log('Finally, everything is done!')
});
```

- [ ]

```js
$('#element').promise().then(function() {
console.log('Finally, everything is done!')
});
```

[Source: HTMLElement: animationend event | MDN ](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/animationend_event)

[Example: Stackoverflow](https://stackoverflow.com/questions/49580666/check-if-an-css-animation-is-completed-with-jquery-or-js)

#### Q69. HTML5 data attributes allow you to create valid custom attributes to store arbitrary data within DOM elements. jQuery has an API to interface with custom data such as the series of quotes below. How can you mark the second quote as your favorite?

```html
<div class="quotes">
<blockquote data-favorite="false">A quote</blockquote>
<blockquote data-favorite="false">A favorite quote</blockquote>
<blockquote data-favorite="false">A quote</blockquote>
<blockquote data-favorite="false">A quote</blockquote>
</div>
```

- [ ] `$('blockquote'):second().attr('favorite', true);`
- [x] `$('blockquote:nth-child(2)').data('favorite', true);`
- [ ] `$('blockquote').second().data('favorite', true);`
- [ ] `$('blockquote:nth-child(2)').attr('favorite', true);`

[Source: .data() | jQuery API Documentation](https://api.jquery.com/data/)

[Source: :nth-child() | MDN Docs](https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child)

#### Q70. jQuery can create event handlers that execute exactly once. How is this done?

- [ ] `$('button').click(function() { console.log('this will only happen once'); }, false);`
- [ ] `$('button').on('click', function() { console.log('this will only happen once'); }).off('click');`
- [ ] `$('button').once('click', function() { console.log('this will only happen once'); });`
- [x] `$('button').one('click', function() { console.log('this will only happen once'); });`

[Source: .one() | jQuery API Documentation](https://api.jquery.com/one/)

#### Q71. You want to implement the behavior of an effect like `slideDown()` manually using `animate()`. What is one critical point you need to remember?

- [ ] `slideDown()` requires animating the background color; doing so with `animate()` requires the jQuery Color plugin.
- [x] `slideDown()` includes toggling visibility automatically. `animate()` does not automatically set any properties.
- [ ] `slideDown()` requires the element to have a height set in pixels. `animate()` does not.
- [ ] Effects created with `animate()` must be run over at least 100 milliseconds, where `slideDown()` can run as quickly as 50ms.

[Source: .slideDown() | jQuery API Documentation](https://api.jquery.com/slidedown/)

[Source: .animate() | jQuery API Documentation](https://api.jquery.com/animate/)\

#### Q72. What is the main difference between the `contents()` and `children()` functions?

- [ ] They both return the content of selected nodes, but `children()` also includes text and comment nodes.
- [ ] The `contents()` function only includes text nodes of the selected elements.
- [ ] The `children()` function only includes text nodes of the selected elements.
- [x] They both return the content of selected nodes, but `contents()` also includes text and comment nodes.

[Source: .children() | jQuery API Documentation](https://api.jquery.com/children/)

[Source: .contents() | jQuery API Documentation](https://api.jquery.com/contents/)