Skip to content

Commit

Permalink
latest c++,git and CSS question added which is asked to me on my link…
Browse files Browse the repository at this point in the history
…edIn assessment (Ebazhanov#906)

* latest c++,git and CSS question added

* latest react quiz

Co-authored-by: Balkrishna Bhatt <[email protected]>
  • Loading branch information
BalkrishnaBhatt and Balkrishna Bhatt authored Jan 6, 2021
1 parent 5138f52 commit 1d0137f
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 7 deletions.
83 changes: 78 additions & 5 deletions c++/c++quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,87 @@ printf("%d",--i);
int c=3; char d='A';
std::printf("c is %d and d is %c",c,d);
```
- [] c is d and d is c
- [] c is A and d is 3
- [] c is 3 and d is A << correct
- [] c is c and d is d
- []c is d and d is c
- []c is A and d is 3
- []c is 3 and d is A << correct
- [] c is c and d is d
#### Q.26 What is the output of this code?
```c++
printf("1/2 = %f",(float)(1/2));
```

- []1/2 = 0.499999
- []1/2 = 0
- []1/2 = 0.000000 << correct
- [] 1/2 = 0.5

### Q.27 What is the difference between a public and a private class member?

- [] Public members are the same as global variables, so every part of the code has access to them. Private members are the same as automatic variables, so only their class has access to them.
- [] Public members are made accessible to any running application. Private members are made accessible only to the application where the object is instantiated.
- [] Public members will be compiled as shared variables in a multithreaded environment. Private members will be compiled as Thread-local variables.
- [] Public members can be accessed by any function. Private members can be accessed only by the same class's member functions and the friends of the class.

### Q.28 What is the value of x after running this code?

```c++
int x=10, a=-3;
x=+a;
```

- []3
- []7
- []-3
- [] 13

### Q.29 Which statement is true?

- []Only classes can have member variables and methods.
- []C++ supports multiple inheritance.
- []C++ supports only single inheritance.
- [] Only structs can inherit.

### Q.30 Consider a pointer to void, named ptr, which has been set to point to a floating point variable g. Which choice is a valid way to dereference ptr to assign its pointed value to a float variable f later in the program?

```c++
float g;
void *ptr=&g;
```

- []float f=*(float)ptr;
- []float f=(float *)ptr;
- []float f=(float)*ptr;
- [] float f=*(float *)ptr;

### Q.31 What is the .* operator and what does it do?

- []It is the same as the class member access operator, or arrow operator (->), which allows you to access a member of an object through a pointer to the object.
- []It is the pointer to member operator, and it allows you to access a member of an object through a pointer to that specific class member.
- []It is the member access with address of operator, which returns the address of a class or struct member.
- [] It is a combination of the member access operator (.) and the dereference operator (*), so it allows you to access the object that a member pointer points to

### Q.32 For these declarations, which choice shows four equivalent ways to assign the character "y" in the string to a char variable c?

a) c = buff[16];
C = str[5];
C = * (buff+16);
c = * (str+5);
b) C = *(buff[15]);
C = * (str[4]);
c = buff+15;
C-str+4;
c) c = buff[15];
C = str[4];
c = (buff+15);
C = *(str+4);

#### Q.33 What is the output of this code?
```c++
printf("1/2 = %f",(float)(1/2));
```
- [] 1/2 = 0.499999
- [] 1/2 = 0
- [] 1/2 = 0.000000 << correct
Expand Down
14 changes: 14 additions & 0 deletions css/css-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -669,3 +669,17 @@ p:first-child {
- [ ] green
- [x] red
- [ ] yellow

### Q53. What is the ::placeholder pseudo-element used for?

- [x] It is used to format the appearance of placeholder text within a form control.
- [ ] It specifies the default input text for a form control.
- [ ] It writes text content into a hyperlink tooltip.
- [ ] It writes text content into any page element.

### Q54. Which statement is true of the single colon (:) or double colon (: :) notations for pseudo-elements-for example,::before and : before?

- [ ] All browsers support single and double colons for new and older pseudo-elements. So you can use either but it is convention to use single colons for consistency.
- [ ] In CSS3, the double colon notation (: :) was introduced to create a consistency between pseudo-elements from pseudo-classes. For newer browsers, use the double colon notation. For IE8 and below, using single colon notation (:).
- [ ] Only the new CSS3 pseudo-elements require the double colon notation while the CSS2 pseudo-elements do not.
- [ ] In CSS3, the double colon notation (::) was introduced to differentiate pseudo-elements from pseudo-classes. However, modern browsers support formats. Older browsers such IE8 and below do not
4 changes: 2 additions & 2 deletions git/git-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -765,5 +765,5 @@ Which of the following options is correct ?

- [ ] git master --status
- [ ] git branch --status
- [ ] git branch --merged
- [ ] git status --merged
- [x] git branch --merged
- [ ] git status --merged
30 changes: 30 additions & 0 deletions react/reactjs-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,3 +479,33 @@ Which library does the fetch() function come from?
- [ ] `ReactDOM`
- [X] `No library. fetch() is supported by most browsers.`
- [ ] `React`

#### Q50.
What is the difference between the click behaviors of these two buttons(assuming that this.handleClick is bound correctly)

```javascript

A. <button onClick=fthis.handleClickl>Click Me</button>
B. <button onClick={event => this.handleClick(event)}>Click Me</button>

```

- [ ] `Button A will not have access to the event object on click of the button`
- [ ] `Button A will not fire the handler this.handleClick successfully`
- [ ] `There is no difference`
- [ ] `Button B will not fire the handler this.handleClick successfully`

#### Q51.
What will happen when this useEffect Hook is executed, assuming name is not already equal to John?

```javascript
useEffect(() => {
setName("John");
}, [name]);
```


- [ ] `It will cause an error immediately.`
- [ ] `It will execute the code inside the function, but only after waiting to ensure that no other component is accessing the name variable.`
- [ ] `It will update the value of name once and not run again until name is changed from the outside.`
- [ ] `It will cause an infinite loop.`

0 comments on commit 1d0137f

Please sign in to comment.