a. num1 = 35;
Explanation of Solution
num1 = 35; is a valid assignment as integer 35 is be...
b. newNum = num1 – num2;
Explanation of Solution
newNum = num1 – num2; is a valid assignment although the variables num1 and num2 have not been initialized. If a variable is used in an expression, the expression would yield a meaningf...
c. num1 = 5; num2 = 2 + num1; num1 = num2 / 3;
Explanation of Solution
num1 = 5; num2 = 2 + num1; num1 = num2 / 3; are valid assignments. num1 =5; declares and initializes the variable num1. num2 = 2 + num1; assigns the value of the expression 2 + num1 to num2. Since num1 has been declared and assigned a value, the right-hand expression value is 2 + 5 = 7...
d. num1 * num2 = newNum;
Explanation of Solution
num1 * num2 = newNum; is not a valid assignment as the left hand of a valid assignment is a variable and not an expression...
e. x = 12 * num1 - 15.3;
Explanation of Solution
x = 12 * num1 - 15.3; is a valid assignment although the variable num1 in the expression on the right-hand side has been declared but not initialized before being used in the expression. If a variable is used in an expression, the expression would yield a meaningful value only if the variable has first been initialized...
f. num1 * 2 = newNum + num2;
Explanation of Solution
num1 * 2 = newNum + num2; is not a valid assignment as the left hand of a valid assignment is a variable and not an expression...
g. x / y = x * y;
Explanation of Solution
x / y = x * y; is not a valid assignment as the left hand of a valid assignment is a variable and not an expression...
h. num2 = num1 % 2.0;
Explanation of Solution
num2 = num1 % 2.0; is not a valid assignment as the expression on the right-hand side would not evaluate. The expression on the right-hand si...
i. newNum = static_cast<int> (x) % 5;
Explanation of Solution
newNum = static_cast<int> (x) % 5; is a valid assignment. The double variable is explicitly cast to an int type before it participates as an oper...
j. x = x + y - 5;
Explanation of Solution
x = x + y - 5; is a valid assignment although the variables x and y have not been initialized before being used in the expression. The expression on the right side...
k. newNum = num1 + static_cast<int> (4.6 / 2);
Explanation of Solution
newNum = num1 + static_cast<int> (4.6 / 2); is a valid assignment. The expression on the right-hand side evaluates an unpredictable but int type value. The expression inside the parentheses is evaluated first where the denominator is implicitly casted to floating-point type (as the numerator is floating-point type)...
Trending nowThis is a popular solution!
Chapter 2 Solutions
C++ Programming: From Problem Analysis to Program Design
- 1 2 var a = 6; 3 var b = 5; 4 var c = 0; 6 function mystery (numl, num2) { 7 var a; 8. c = numl + num2; 6. a = numl + num2 + C; 10 num2 - numl; document.write(c + "" ); document.write(a + "" ); 11 12 13 } 14 15 mystery ( 4, 3); 16 document.write(a + + b + ""); 17 document.write(c + "" ); 18 19 What value for 'c' does line 11 display? What value for 'a' does line 12 display: What value for 'a' does line 16 display: What value for 'b' does line 16 display: What value for 'c' does line 17 display:arrow_forwardTRUE FALSE & is used to pass a parameter by value * is used as a reference operator * is called the dereference operatorarrow_forwardL et D= { s, d, b}, E= { c, k}, G= { a, k }, U={a, b, c, d, k, s} DUE=arrow_forward
- Salesforce Programming Problem(Use Salesforce Developer Console to solve the problem) In this assignment you have to create a query that will fetch the data of contact object where the phone number is not null and the contact's name should be in ascending order.arrow_forwardISBNThis problem is slightly more difficult than the above problem. This one requires a data type that stores 10 digits. BackgroundPublishers and bookstores use a number system called the International Standard Book Number (ISBN) system to identify books. At the start of publication, each book is assigned a unique ISBN. An ISBN, once assigned, can never be re-used. Click here for detailed information on this numbering system.An ISBN consists of exactly 10 digits. The rightmost digit is the check digit. The check digit is validated modulo 11.• multiply each digit from the first to the ninth by a weight from 10 to 2 respectively (the first digit by 10, the second by 9,.., the ninth by 2).• the sum of the products plus the check digit should be divisible without remainder by 11.• if there is a remainder, the whole number is not a valid ISBN SpecificationsDesign a program that validates an ISBN. Your program keeps accepting a whole number and determining if that whole number is a valid…arrow_forwardIn the C programming language, if all function prototypes are listed at the top of your code, outside and above all functions, you do not need to worry about the order of the function definitions within the code. True Falsearrow_forward
- You have the following workspace in MATLAB: Workspace Name Value Beccentricity Egrav_const Binclination Emass_Earth Horbit_period Bradius_Earth E semi_major E spacecraft_loc 6918900 E spacecraft_vel 7.5883e+03 2.8300e-04 6.6730e-11 28.4700 5.9720e+24 95.4320 6378000 6917100 In the box below, fill in the exact command necessary to delete the variable spacecraft_vel from the workspace without deleting any other variables clear spacecraft_vel Question 2 In MATLAB, you are calculating friction forces on five rail materials for a comparison study. One variable you must define is the time traveled on the aluminum rail. Which of the following are appropriate, descriptive variable names that could be used for this variable? Select all that apply. timeAl alum time Alt U aluminum timearrow_forwardoop_c++ TEST_cases(Question2_1, First) {// static Employee *SI[10]; Employee e[10],obj,**t;for(int k=0;k<10;k++){e[k].setSalary(1000+100*k); }t=obj.Temporary(e); double result=obj.print(t,e,5); ASSERT_EQ(1611,int(result));}TEST(Question2_2, second) {// static Employee *SI[10]; Employee e[10],obj,**t;for(int k=0;k<10;k++){e[k].setSalary(1000+100*k); }t=obj.Temporary(e); double result=obj.print(t,e,5); ASSERT_EQ(1640,int(result));} Double print (Employee**, Employee [], int)arrow_forwardA "generic" data structure cannot use a primitive type as its generic type. O True Falsearrow_forward
- in c language typedef _people { int age; char name[ 32 ] ; } People_T ; People_T data [ 3 ]; Using string lib function, Assign 30 and Cathy to the first cell, Assign 40 and John to the second cell and Assign 50 and Tom to the third cellarrow_forward#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #define NAME_LEN 25 #define MAX_PARTS 100 struct part { int number; char name[NAME_LEN + 1]; int on_hand; double price; } inventory[MAX_PARTS]; int num_parts = 0; int find_part(int number); void insert(void); void search(void); void update(void); void print(void); int read_line(char str[], int n); int main(void) { char code; for (;;) { printf("Enter operation code: "); scanf(" %c", &code); while (getchar() != '\n') /* skips to end of line */ ; switch (code) { case 'i': insert(); break; case 's': search(); break; case 'u': update(); break; case 'p': print(); break; case 'q': return 0; default: printf("Illegal code\n"); } printf("\n"); } } int find_part(int number) { int i; for (i = 0; i < num_parts; i++) if…arrow_forwardCourse Name : Compiler Construction and programming languages Scanner /lexer In this assignment, you will write a lexical analyzer for a one of the following JavaScriptprogramming language 1. Token specification:You must create a table of the JavaScript programming language tokens as follows TOKEN Description Pattern/Rule lexeme examples 2. Write a Lex specification file and use the Lex generator to construct a lexical analyzer for the JavaScript programming language with the following lexical properties:1. Identifiers.2. Keywords.3. Literals.4. Operators.5. Delimiters 3. Test the lexical analyzer using sample of source files from the JavaScript programming language. 4. Write a Lex program to remove comments from the JavaScript languagearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education