Question 11 --> solving innner bracket first (4-3 && 6) yields True then (false || True) which is an OR operation yields True
Answer is True
Question 12 --> -1 == 0 yields flase and negation of false is true
Answer is True
Question 13 --> It is for loop counting 1 to 4 with 4 included
Answer is 1 2 3 4
What is the value of the following expression? true false 0 illegal syntax if x is...
QUESTION 1 Which statement results in the value false? The value of count is 0; limit is 10. (count != 0)&&(limit < 20) (count == 0)&&(limit < 20) (count != 0)||(limit < 20) (count == 0)&&(limit < 20) 10 points QUESTION 2 If this code fragment were executed in an otherwise correct and complete program, what would the output be? int a = 3, b = 2, c = 5 if (a > b) a = 4; if (...
What is the output of the following code snippet? (If there is some kind of syntax error indicate this by marking "error" in your answer choice) 1. int fly = 5; int x; if (fly-- > 5) x = 5; else x = 2; if (x++ > 3) cout << x; cout << fly << endl; 2. int i = 0; bool b = i == 0 || i++ > 0; if (!b) cout << i << endl; else cout...
3) What are the final values of a, b, c in the following code fragment (1.5 point): int a = 6 , b = 127 , c; c = ( ++a ) + ( b -- ); Answer: 4) What are the final values of a, b, c in the following code fragment (1.5 point): int a = 6 , b = 127 , c; c = (a++) + ( -- b); Answer: 5) What is displayed by this poorly...
Name: True/False & Multiple Choice (2 points each) (True / False ) 2 A char literal '2', a string literal "2", and the numeric literal 2 are identical and stored the same way though they are different types. 3 Since comments do not affect the program execution, you don't need to have it at all. 4. After the following statements are executed, the value of the variable rem is 3. 1. A preprocessor directive line starts with a pound sign...
Please Help with the following questions (just true or false, except last one is choose 1) QUESTION 1 Given: int myvar=99; Is this expression true or false? myvar (That is, is the value of myvar, 99, true or false) True False QUESTION 2 Given: int myvar=3; int yourvar=0; Is the following expression true or false? myvar == 3 && yourvar == 0 True False QUESTION 3 Given: int myvar=3; int yourvar=0; Is the following expression true or false? myvar ==...
QUESTION 3 Assume x = 4 and y = 5, which of the following is true? x < 5 || y < 5 x > 5 || y > 5 x < 5 && y < 5 x > 5 && y > 5 QUESTION 14 Which of the following statements are the same? (A) x -= x + 4 (B) x = x + 4 - x (C) x = x - (x + 4) (A) and (B) are...
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...
What is the output of the program segment? Assume there are no syntax errors and the code will compile. int i = 1; int n = 0; do { cout << i; i++; } while (i <= n); b) What are the values of i and n after execution? Assume there are no syntax errors and the code will compile. int i = 1; int n = 0; do { cout << i; i++; } while (i <= n);
What will be the value of x after the following code is executed? int x = 5; while (x <50) { x += 5; } a) 50 b) 45 c) Infiniteloop d) 55 Given the following code segment: Scanner in = new Scanner (System.in); boolean done = false; while (!done) { int input = in.next(); if(input.equalsIgnoreCase("q")) done = false; } What will cause the loop to terminate? a) When the user enters -1 b) The loop will never terminate c)...
11. A _____________ error does not cause the compiler to generate an error, but does cause the program to produce incorrect results. Syntax, logic, variable name, function name 12. A syntax error occurs when the programmer violates one or more grammar rules of the C language. True or False 13. Given this line of code: y = sqrt(x); x would be known as the argument. True or False 14. A void function does not return a value to the...