Exam 1

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Select the answer that best matches the prompt. Every answer choice should be used once. Prompt: #include <studio.h> int main (void) { //My first program printf("Programming is fun.\n"); return 0; } Answer choices: comments, not considered for compilation and execution indicates the beginning of the function indicates the end of the function main function from where execution of any program begins preprocessor command prints the output onto the screen terminates the program

#include <studio.h> | preprocessor command int main (void) | main function from where execution of any program begins { | indicates the beginning of the function //My first program | comments, not considered for compilation and execution printf("Programming is fun.\n"); | prints the output onto the screen return 0; | terminates the program } | indicates the end of the function

What will be the value of discountRate after the following statements are executed? double discountRate; char custType = 'B'; switch (custType) { case 'A': discountRate = 0.08; break; case 'B': discountRate = 0.06; case 'C': discountRate = 0.04; default: discountRate = 0.0; } 0.08 0.06 0.04 0.0

0.0

What will be the value of BONUS after the following statements are executed? int bonus, sales = 10000; if (sales < 5000) bonus = 200; else if (sales < 7500) bonus = 500; else if (sales < 10000) bonus = 750; else if (sales < 20000) bonus = 1000; else bonus = 1250; 750 1250 500 1000

1000

What is the value of x after the following code has been executed? int x = 75; int y = 90; if (x != y) x +=y; 75 90 15 165

165

What will be the value of x after the following statements are executed? int x = 10; switch (x) { case 10: x += 15; case 12: x -= 5; break; default: x *= 3; } 30 20 25 5

20

What is the value of ans after the following code has been executed? int x = 35; int y = 20, ans = 80; if (x < y) ans += y; 80 100 35 55

80

All it takes for an AND expression to be TRUE is for one of the subexpressions to be TRUE. -True -False

False

All it takes for an OR expression to be TRUE is for one of the subexpressions to be TRUE. -True -False

True

Lowercase and uppercase letters are distinct in programming language. -True -False

True

Variables should be declared in the program before used. -True -False

True

What is the value of ans, x, and y after the following statements are executed? int ans = 0, x = 15, y = 25; if (x >= y) { ans = x + 10; x -= y; } else { ans = y + 10; y +=x; } -ans = 0, x = 15, y = 25 -ans = 25, x = -10, y = 25 -ans = 35, x = 15, y = 40 -ans = 25, x = 15, y = 40

ans = 35, x = 15, y = 40

Which of the following expressions determines whether the CHAR variable, chrA, is not equal to the letter 'A'? -chrA == 'A' -chrA != 'A' -chrA | | 'A' -chrA.notEquals(A)

chrA != 'A'

Which is NOT a valid variable name? _average sum totalBill int

int

Which is not a valid data type? -int -char -float -number

number

Which function is used to read the input from the keyboard? -printf() -scanf() -getinput() -read()

scanf()


Kaugnay na mga set ng pag-aaral

Musculoskeletal/Neurological Quiz- EAQ

View Set

Chapter 2: 2.3 Enterprise Resource Planning (ERP) Systems

View Set

Practicing for NCLEX Questions: Mobility

View Set

Chemistry: 1.4 - Uncertainty in Measurments

View Set

Cumulative Exam- Career Planning & Development (96%)

View Set