1. What condition makes the loop output the even numbers 2 through 20?
var c = 2;
while (_____) {
console.log(c);
c += 2;
}
a). c >= 20
b). c <= 20
c). c < 20
2. lowerCaseLetters = "abc";
upperCaseLetters = "ABC";
if (lowerCaseLetters > upperCaseLetters) {
length++;
}
a). true
b). false
3. score = 2;
if (score === "2") {
score = 10;
}
a).true
b).false
4. Indicate if the statements contain an error or not.
/* a is assigned 2
a = 2;
a.)Error
b).No error
5. What is the data type of z?
var z;
a).undefined
b).string
c).number
1)
Answer: c<=20
loop runs upto c=20 from c=2, printing every even number
2)
Answer:True
lowercase string has higher ascii value than uppercase
3)
Answer:False
both are of different type
4)
Answer:a)Error
variable a is not declared
//if a is already delcared then it is not error
5)
Answer:a)undefined
1. What condition makes the loop output the even numbers 2 through 20? var c =...
1. (a) Before entering any while loop, the while loop condition is. . . A. true B. false C. true or false (b) At the beginning of each iteration, a while loop condition is. . . A. true B. false C. true or false (c) When the loop terminates, a while loop condition is. . . A. true B. false C. true or false (d) Which of the following statements will not cause a compile-time error? A. byte b =...
Question 21 The loop condition can be a complex condition involving several operators. True OR False Question 22 final int MAX = 25, LIMIT = 100; int num1 = 12, num2 = 25, num3 = 87; if(num3-5 >= 2*LIMIT) { System.out.println ("apple"); } else { System.out.println ("orange"); } System.out.println("grape"); What prints? A. Apple B. Orange C. Grape D. apple grape E. orange grape F. Nothing. Question 23 When we use a while loop, we always know in advance how many...
Using C++ 1. Create a while loop that counts even numbers from 2 to 10 2. Create a for loop that counts by five (i.e. 0, 5, 10, ...) from 0 to 100 3. Ask for a person's age and give them three tries to give you a correct age (between 0 and 100) 4. Use a for loop to list Celsius and Fahrenheit temperatures. The "C" should be from -20 to 20 and the F should be shown correspondingly...
need asap
Homework (5) 1. There are two basic forms of loop constructs: - and 2. Which of the following is an alternate and faster way of performing the same function as many MATLAB for loops? a) a. Exhaustive enumeration b) b. Vectorization c) c. Variable declaration d) d. Amortization 3. A while loop is a block of statements that are repeated indefinitely as long as some condition is satisfied. a) True b) False 4. The for loop is a...
C++
help! #4,6,7
c) no-test d) loop-test e) None of these 1. Which of the following variable names is invalid? a) numstudents b) 2Darray c) studentHame d) test Grade 祁.which of the following conditions is true ifX has a value of 10 and T has a value of 20? None of these 2. In Ca4, the operator indicates: a) subtraction b) negation c) equality e) None of these . What are the final values of z and y after the...
1. Let X and Y be two random variables.Then Var(X+Y)=Var(X)+Var(Y)+2Couv(X,Y). True False 2. Let c be a constant.Then Var(c)=c^2. True False 3. Knowing that a university has the following units/campuses: A, B , the medical school in another City. You are interested to know on average how many hours per week the university students spend doing homework. You go to A campus and randomly survey students walking to classes for one day. Then,this is a random sample representing the entire...
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...
31. True or False: The condition in the following if statement is a syntax error: int number=50;…… if (number)…… 32. True or False: The standard C functlon strlen) will return 4 when invoked upon the varlable name, declared below: char namel = (e', 'p', 't', 's', '\0', '1', '2', '1', '\0']; 33. True or False: A structure is a collection of related variables under one name. 34. True or False: In C, output parameters allow for a function to return more than one value Indirectly. 35. True or...
1) Which of the following is NOT true about a Python
variable?
a) A Python variable must have a value
b) A Python variable can be deleted
c) The lifetime of a Python variable is the whole duration of a
program execution.
d) A Python variable can have the value
None.
2) Given the code segment:
What is the result of executing the code segment?
a) Syntax error
b) Runtime error
c) No error
d) Logic error
3) What...
Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C - A consecutive group of memory chunks. D - None of the choices. Question 2 How many times is the body of the loop executed? int i=1; while(true) { cout << i; if(++i==5) break; } A - Forever B - 4 C - 5 D - 6 E - 0 Question 3 What is wrong with the following piece of...