1) The correct declaration is :
for(var j=x;j<=y;j+=5) this will run without error, all others
will have runtime errors.
2)Switch statement can be used to handle decision making , and can
replace multiple if else.
3)answer is 7,0 as in first the loop is executed one time with do
while and then will not be executed as count<6 is false and loop
terminates, but one time it runs and assign num=count, but in
second code section we are using while(count<6) and then
executing num=count which will not be executed as count<6 is
false.
not sure about 4th
if you like the answer please provide a thumbs up.
1. Which of the following is declared correctly and will not result in an error, assuming...
Question 1: Given the following HTML code segment <p>While this is a <b> very basic HTML document </b>, it actually serves as a detailed example of the document object model. </p> How many text nodes will be added to the DOM tree to represent the structure of text content in this HTML code segment A. 1 B. 2 C. 3 D. 4 Question 2: Assume in an HTML document named “index.html”, the following <script> element is added <script src="grocery.js"></script> This...
Given a starting sphere code, modify the Java and HTML code to create multiple spheres that will rotate in different positions at different speeds. basicSphere.js: "use strict"; var canvas; var gl; var numTimesToSubdivide = 3; var index = 0; var pointsArray = []; var va = vec4(0.0, 0.0, -1.0,1); var vb = vec4(0.0, 0.942809, 0.333333, 1); var vc = vec4(-0.816497, -0.471405, 0.333333, 1); var vd = vec4(0.816497, -0.471405, 0.333333,1); var program; var program1; function triangle(a, b, c) { pointsArray.push(a);...
HTML ASSIGNMENT Question 1: What is the value of the variable age after the following JavaScript statements are executed? var age = 30; age = " age is: " + age + 5; A. age is 30 B. age is + age + 5 C. age is 305 D. age is 35 Question 2: Assume there is an external JS file named "addContent.js". This file is located in the same folder as the HTML document "addContent.html". In order to make...
1. Given the following code snippet, what is the scope of the variable pen on Line 1? <script> 1. var pen = "ball point"; 2. var pencil = "0.7mm lead"; 3. function writeIt() 4. { 5. document.write(I have a " + pen + " pen."); 6. pen = "gel ink"; 7. document.write("You have a " + pen + " pen."); 8. var pencil = "0.5mm lead"; 9. document.write("I prefer pencils with " + pencil + "."); 10. } <script> A. global B....
Multiple Choice Identify the choice that best completes the statement or answers the que 1. Which of the following is a valid Java identifier? Spay b. 4myGrade! c. newGrade! d. 1dollar static final int EndVal-1: int double; int num console.nextInt(); while (num != Endval) double num * 2; System.out.println (double); num console.next1nt(); 2. The above code is an example of a(n)--while loop. a. flag-controlled b. counter-controlled c. EOF-controlled d. sentinel-controlled 3. The length of the string "first java program" is:...
31. The following code segment is syntactically correct: int number{20}; cout << number << setbase(16) << " " << number << setbase(10) << " " << number << showpos << " " << number << endl; T__ F__ 32. The following statement wants to determine if ‘count’ is outside the range of 0 through 100: if (count < 0 && count > 100) T__ F__ 33. There is...
Unit 1 Programming Assignment Follow the directions for each of the following questions. Answer the question or provide the code in a space below the question. 1. Write the complete script tag set for a script whose line statement is document.write(“Hello, world.”); 2. Build a complete HTML document and include the answer to the previous question such that the page executes the script as the page loads. Open the document in your browser to test the results. 3. Add a...
1. Assuming each line of information is stored in a new array, which of the following pairs are not parallel arrays? A. names of all students at Santa Fe College ID numbers of all students at Santa Fe College B. names of all students at Santa Fe College names of all students taking JavaScript at Santa Fe College C. names of all students at Santa Fe College email addresses of all students at Santa Fe College D. All three sets...
State true or false: (6 x 2 = 12 pts) Using -- with a reverse iterator moves it from the back toward the front of a list b) The body of a do-while loop is always executed at least once. c) If p points to the array element a[j], then p + i points to a[i+j]. d) Any number of pointer variables may point to the same object. In terms of both execution speed and memory usage usually iterative solutions...
howthe output of the following 4 program segments (a) const int SIZE=8; int values[SIZE] = {10, 10, 14, 16, 6, 25, 5, 8}; int index; index=0; res = values[index]; for (int j=1; j<SIZE; j++) { if (values[j] > res) { res = values[j]; index = j; cout << index << res << endl; } } cout <<...