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

Update: Add Q#69 with answer #2426

Merged
merged 9 commits into from
Oct 15, 2021
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
11 changes: 11 additions & 0 deletions c++/c++quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -1173,3 +1173,14 @@ Note: This one is similar to Q6, but focuses on the `const` keyword.
- [ ] a string with more than 255 characters

[Reference](https://www.educba.com/c-plus-plus-double/)

#### Q69. Consider this function declaration of is_even, which takes in an integer and returns true if the argument is an even number and false otherwise. Which declarations are correct for overloaded versions of that function to support floating point numbers and string representations of numbers?

```cpp
bool is_even(int);
```

- [x] bool is_even(float f); bool is_even(char *str);
- [ ] bool is_even(float f); bool is_even(char str);
- [ ] bool is_even_float(float f); bool is_even_str(char *str);
- [ ] float is_even(float f); char *is_even(char *str);
18 changes: 18 additions & 0 deletions python/python-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -1289,3 +1289,21 @@ num_list[len(num_list)//2]
- [ ] dateday
- [ ] daytime
- [ ] timedate

#### Q95. What is the correct syntax for defining a class called Game?

- [ ] def Game(): pass
- [ ] def Game: pass
- [x] class Game: pass
- [ ] class Game(): pass

[reference here](https://docs.python.org/3/tutorial/classes.html)

#### Q96. What does a class's init() method do?

- [ ] The __init__ method makes classes aware of each other if more than one class is defined in a single code file.
- [ ] The __init__ method is included to preserve backward compatibility from Python 3 to Python 2, but no longer needs to be used in Python 3.
- [x] The __init__ method is a constructor method that is called automatically whenever a new object is created from a class. It sets the initial state of a new object.
- [ ] The __init__ method initializes any imports you may have included at the top of your file.

[reference here](https://stackoverflow.com/questions/625083/what-init-and-self-do-in-python)