Given the following JavaScript script segment: var x=0; var y=2; var z=0; if(x==
ID: 3574143 • Letter: G
Question
Given the following JavaScript script segment: var x=0; var y=2; var z=0; if(x==0|| y==0) {x=1;} else if (x!=0 || y!=0) {x=y;}} else {if (y ! = 0 && z! = 0) {x=z;} else{x = false;}} What is the final value of x? a. 0 b. 1 c. 2 d. false What is the result of evaluating the following expression: 41 % 8 a. 0 b. 1 c. 2 d. all of the above e. none of the above What kind of errors can occur in a Javascript program: a. Logic errors b. Syntax errors c. Runtime errors d. all of the above e. none of the aboveExplanation / Answer
Q: What is value of X ?
Here in first if condition will not get statify for a given variable values above. becasue x= 0 and y not equal to 0. So the interpreter goes to else if and check for the conditon with declared varaiable values given. and now finally reached to else condition here,
else {
if (y!=0 && z !=0) ...............but here this conditon also fails because y = 2 and z = 0
{
x=z
}
So finally, else after this will be executed and the values of x here is False
So, Answer is FALSE.
12 Q: Before answering this, I want you to know what is modulus.
Modulus means, it divides left-hand operand by right-hand operand and returns remainder.
41% 8.
Means 41 is divided by 8 and the reminder will be. 1
So Answer is : 1 (I mean: option A)
13 Q:
Types of Errors in Java:
System Errors
Syntax Errors
Semantic Errors
Runtime Errors
Logical Errors
These are the errors will occur in java.
So, Choice would be [d. All the above]
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.