Question 1 in the following code: int myVal = computeValue(2, 3); int computeVal
ID: 3876757 • Letter: Q
Question
Question 1
in the following code:
int myVal = computeValue(2, 3);
int computeValue (int x, int y) {
int result = x+y;
return result;
}
2 is
options:
a parameter
An argument
the function body
the header of the function computeValue
Question 2
When writing
Variable1 == Variable2,
the contents of Variable2 are tested against the contents of Variable1;
If they are equal, then the evaluation will yield true, otherwise it will yield false
options:
True
False
Question 3
When writing
Variable1 == Variable2, the content of Variable2 gets copied in Variable1
options:
True
False
Explanation / Answer
Hi,
Please find the Answers for your Questions.
Question 1 :
Answer is An argument
Explanation : Since 2 is a value to method as argument.
Question 2:
Answer is false.
because == is an operator it always validate references objects are pointing to the same object, Not contents are equals or not.
Explanation :
String s1=new String("hai");
String s2=new String("hai");
s1==s2 false (s1 and s2 references pointes to different objects)
s1.equals(s2) true (even though both object references are diffrent in String class equals method is overriden for content comparison so true).
Question 3:
Answer is false
Explanation :
== oprator is used for comparision and = operator used for assignments
Variable1 = Variable2; this case right side variable value assined to left side value.
Question 4:
Answer is true.
Explanation:
NOT(A && B) is Equivalent to (NOT(A) OR NOT(B))
Question 5:
Answer false
Explanation:
String hey hello;
Compilation Error
Question 6:
Answer True.
Explanation:
if everything is || it will stop after the first true
if everything is && it will stop after the first false
&& or || , Java will use short-circuit evaluation
Question 7:
Answer is , 4 integers whose indices range from 0 to 3
Explanation:
Because array index starts with 0 and ends with length-1
In the above length 4 so ,0 to 4-1=3
Question 8:
Answer is False both are not equal
Explanation:
if everything is || it will stop after the first true
if everything is && it will stop after the first false
&& or || , Java will use short-circuit evaluation
Question 9:
Answer is 7.
Explanation:
index starts with 0 ends with length-1
Question 10:
Answer is True.
Question 11:
Answer is True
Explanation:
Question 12:
Answer is, all of the above .
Explanation is :
By seeing that declared an array with name myArray and initialized size with 4 and 4 integers willbe there
if we try to print like this
System.out.println(myArray[0]);//0
System.out.println(myArray[1]);//0
System.out.println(myArray[2]);//0
System.out.println(myArray[3]);//0
four zeros (integers).
Question 13:
Answer : x is, a parameter
Explanation:
x is parameter to the method.
Question 14:
Answer is, A function call
Question 15 :
Answer is True, int x, int y are two int references
Question 16 :
Answer is, a || (b &&c)
Explanation : if || first true means no need to check &&
Question 17 :
Answer is false,
== is operator is used for comparision
= is an operator used to assign
Question 18 :
Answer is False
Question 19 :
Answer is True
Question 20 :
Answer is False,
Explanation:
==
!= have Left to right precedence
and
? : (Ternary conditional) Right to left precedence.
Thank You.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.