Consider the following instance variable and method:
private int[] nums;
/** print the elemen...
![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 12.04.2021 01:00 asiababbie33
Consider the following instance variable and method:
private int[] nums;
/** print the elements that are in the odd index locations off an array: EX: 1, 3, 5, etc. */
public void printOddIndices()
{
/* missing code */
}
Which of the following replacements for /* missing code */ correctly implements the method printOddIndices()?
a)
for (int x : nums)
{
if (x % 2 == 1)
{
System. out. println(x);
}
}
b)
for (int x : nums)
{
if (nums[x] % 2 == 1)
{
System. out. println(x);
}
}
c)
for (int k = 0; k < nums. length; k++)
{
if (k % 2 == 0)
{
System. out. println(nums[k]);
}
}
d)
for (int k = 0; k < nums. length; k++)
{
if (nums[k] % 2 == 1)
{
System. out. println(k);
}
}
e)
for (int k = 0; k < nums. length; k++)
{
if (k % 2 == 1)
{
System. out. println(nums[k]);
}
}
![ansver](/tpl/images/cats/User.png)
Answers: 3
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 21.06.2019 22:10
Is the following an example of social media viral marketing? indicate your response by selecting yes or no. when you sign onto your favorite social networking website, you get messages from friends who have seen a television show they thought was a "must see! "
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 12:00
Which of these is a benefit of using objects in a powerpoint presentation? a. collaborators can create the external files while you create and edit the slide show. b. you can easily change the theme and design of the presentation. c. you can have older data in the source file while having up-to-date data in the presentation. d. collaborators can easily share the presentation.
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 14:30
Which of the following would not be considered a pc? a. mainframe b. desktop c. tablet pc d. laptop
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 00:50
3. what is the output of the following statements? temporary object1; temporary object2("rectangle", 8.5, 5); temporary object3("circle", 6, 0); temporary object4("cylinder", 6, 3.5); cout < < fixed < < showpoint < < setprecision(2); object1.print(); object2.print(); object3.print(); object4.print(); object1.set("sphere", 4.5, 0); object1.print();
Answers: 1
You know the right answer?
Questions
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/es.png)
Spanish, 20.09.2020 17:01
![question](/tpl/images/cats/mat.png)
Mathematics, 20.09.2020 17:01
![question](/tpl/images/cats/mat.png)
Mathematics, 20.09.2020 17:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 20.09.2020 17:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/health.png)
![question](/tpl/images/cats/pravo.png)
Law, 20.09.2020 17:01
![question](/tpl/images/cats/ap.png)
Advanced Placement (AP), 20.09.2020 17:01
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 20.09.2020 17:01
![question](/tpl/images/cats/mat.png)
Mathematics, 20.09.2020 17:01
![question](/tpl/images/cats/biologiya.png)
Biology, 20.09.2020 17:01
![question](/tpl/images/cats/biologiya.png)
Biology, 20.09.2020 17:01
![question](/tpl/images/cats/mat.png)
Mathematics, 20.09.2020 17:01
![question](/tpl/images/cats/mat.png)
Mathematics, 20.09.2020 17:01