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 new question to c++ and fixed spacing and choices. #1465

Merged
merged 2 commits into from
Apr 17, 2021
Merged
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
48 changes: 44 additions & 4 deletions c++/c++quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -1003,27 +1003,67 @@ center.x = 9;
center.y = 3;
```

- [ ] ```cpp
- [ ] A
```cpp
struct coord{
int x;
int y;
};
typedef struct coord coord;
```
- [ ] ```cpp
- [ ] B
```cpp
typedef struct coord{
int x;
int y;
} coord;
```
- [ ] ```cpp typedef struct coord{
- [ ] C
```cpp
typedef struct coord{
int x;
int y;
};
```
- [ ] ```cpp typedef struct{
- [ ] D
```cpp
typedef struct{
int x;
int y;
} coord;
```

#### Q60. You want to sort my_array, declared below. Which choice is the correct call to std::sort, using a lambda expression as the comparison function?

```cpp
std::array<uint32_t, 50> my_array;
```

- [ ] A
```cpp
std::sort(my_array.begin(), my_array.end(),
[](uint32_t a, uint32_t b) {
return a < b;
})
```
- [ ] B
```cpp
lambda(uint32_t a, uint32_t b){
return a < b;
}
std::sort(my_array.begin(), my_array.end(), lambda);
```
- [ ] C
```cpp
std::sort(my_array.begin(), my_array.end(),
lambda(uint32_t a, uint32_t b){
return a < b;
})
```
- [ ] D
```cpp
lambda(uint32_t a, uint32_t b){
return a < b;
}
std::sort(my_array.begin(), my_array.end(), &lambda);
```