Quiz React V1
Quiz React V1
Phonenumber……0643726631………………………………………………….
React Quiz
Question 1: Question 8: Question 15:
What is the correct command to create a new React project? Which keyword creates a constant in JavaScript? How can you combine the following arrays using the spread operator?
Question 17:
Question 3: Question 10: What is the correct syntax to import a Component from React?
What command is used to start the React local development server? React component names must begin with an uppercase letter.
(A) True
(B) False (A) key (A) True
(B) index (B) False
(C) id
(D) data
function Car() { (A) Babel (A) Hooks can be called in Class or Function components
return <h1>Ford Mustang</h1>; (B) ReactDOM (B) Hooks can only be called inside React Function components
} (C) React Router (C) Hooks can only be called at the top level of a component
ReactDOM.render(<Car />,document.getElementById('root'));
(D) JSX Compiler (D) Hooks cannot be conditional
(A) Component
(B) ReactDom
(C) div
(D) h1
Phonenumber :………0643726631……………………………………………….
Write a function that mimics (without the use of >>) the right shift
operator and returns the result from the two given integers.
Examples
shiftToRight(80, 3) ➞ 10
shiftToRight(-24, 2) ➞ -6
shiftToRight(-5, 1) ➞ -3
Examples
function CONCAT(...Val){
concat([1, 2, 3], [4, 5], [6, 7]) ➞ [1, 2, 3, 4, 5, 6, 7] let array = [];
concat([1], [2], [3], [4], [5], [6], [7]) ➞ [1, 2, 3, 4, 5, 6, 7] for(let i=0; i<Val.length;i++){
concat([1, 2], [3, 4]) ➞ [1, 2, 3, 4] for(let a=0; a<Val.length; a++){
concat([4, 4, 4, 4, 4]) ➞ [4, 4, 4, 4, 4]
array.push(Val[i][a])
}
iii. Array of Multiples
}
Create a function that takes two numbers as arguments return array;
( num , length ) and returns an array of multiples of num until the }
array length reaches length .
function CONCAT(...Val){
Examples let array = [];
arrayOfMultiples(7, 5) ➞ [7, 14, 21, 28, 35]
for(let i=0; i<Val.length;i++){
arrayOfMultiples(12, 10) ➞ [12, 24, 36, 48, 60, 72, 84, 96, 108, 120] for(let a=0; a<Val.length; a++){
arrayOfMultiples(17, 6) ➞ [17, 34, 51, 68, 85, 102] array.push(Val[i][a])
}
}
return array;
}
Full name : ……………………………………………………………….
Exercise 1:
The following code uses the prompt() function to get two numbers from the user. It then adds those
two numbers together and writes the result to the page:
</script>
</body>
</html>
However, if you try the code out, you'll discover that it doesn't work. Why not? Change the code so that it
does work.
Exercise 2 :
A junior programmer comes to you with some code that appears not to work. Can you spot where he
went wrong? Give him a hand and correct the mistakes.
if (userAge = 0);
{
alert(“So you're a baby!”);
}
else if ( userAge < 0 | userAge > 200)
alert(“I think you may be lying about your age”);
else
{
alert(“That's a good age”);
}
Good luck