1 / 69

CIS 205 Practice Test

CIS 205 Practice Test. George Lamperti. 1. A word that has a predefined meaning in a C++ program and cannot be used as a variable name is known as a _____________________ . a. ID b. reserved word c. non-variable word d. word key.

Download Presentation

CIS 205 Practice Test

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CIS 205 Practice Test George Lamperti

  2. 1. A word that has a predefined meaning in a C++ program and cannot be used as a variable name is known as a _____________________ . a. ID b. reserved word c. non-variable word d. word key

  3. 1. A word that has a predefined meaning in a C++ program and cannot be used as a variable name is known as a _____________________ . a. ID b. reserved word c. non-variable word d. word key

  4. 2. Indicate if the following are input or output statements: a. cin >> x; b. cout << y; c. cin >> a >> b; d. cout << “hello”;

  5. 2. Indicate if the following are input or output statements: a. cin >> x; Input b. cout << y; Output c. cin >> a >> b; Input d. cout << “hello”; Output

  6. 3. Which of the following are valid variable names? a. temperature b. cost_of_living c. $deposit d. side2 e. weight_ f. percent%_raise

  7. 3. Which of the following are valid variable names? a. temperature b. cost_of_living c. $deposit d. side2 e. weight_ f. percent%_raise

  8. 4. Memory that loses its contents when the power is removed is ______________memory. a. hot b. empty c. volatile d. fixed

  9. 4. Memory that loses its contents when the power is removed is ______________memory. a. hot b. empty c. volatile d. fixed

  10. 5. A statement that identifies a variable name to a program is known as a _______________ statement. a. declaration b. static c. variable d. definite

  11. 5. A statement that identifies a variable name to a program is known as a _______________ statement. a. declaration b. static c. variable d. definite

  12. 6. When a function is called, the variables or values within the parenthesis are called _____________________. a. parameters b. entries c. arguments d. variables

  13. 6. When a function is called, the variables or values within the parenthesis are called _____________________. a. parameters b. entries c. arguments d. variables

  14. 7. The variables within the function parenthesis in the function heading are called _____________________. a. parameters b. entries c. arguments d. variables

  15. 7. The variables within the function parenthesis in the function heading are called _____________________. a. parameters b. entries c. arguments d. variables

  16. 8. When inputting characters into char variables, the << operation will skip over _____________________. a. periods b. slashes ( / ) c. numbers d. blanks (white spaces)

  17. 8. When inputting characters into char variables, the << operation will skip over _____________________. a. periods b. slashes ( / ) c. numbers d. blanks (white spaces)

  18. 9. Express each value in E-notation (C++ coding convention) a. 0.00000576 _______________ b. 576,000,000,000.0 _______________

  19. 9. Express each value in E-notation (C++ coding convention) a. 0.00000576 __5.76e-6 ______ b. 576,000,000,000.0 __5.76e11 ______

  20. 10. What values would be assigned to the int variable x in each case? a. x = 5 + 7.6; b. x = 5 / 7.6; c. x = 7 / 5; d. x = 7.6 / 5.5;

  21. 10. What values would be assigned to the int variable x in each case? a. x = 5 + 7.6; 13 b. x = 5 / 7.6; 0 c. x = 7 / 5; 1 d. x = 7.6 / 5.5; 1

  22. 11. The integer constant or variable within brackets used to reference a particular one-dimensional array cell is called the array __________________________. a. counter b. indicator c. index or subscript d. modifier

  23. 11. The integer constant or variable within brackets used to reference a particular one-dimensional array cell is called the array __________________________. a. counter b. indicator c. index or subscript d. modifier

  24. 12. Do array parameter declarations in a function need to use the & operator if the array is to be changed or modified? a. yes – arrays are never passed by reference b. no – arrays are automatically passed by reference

  25. 12. Do array parameter declarations in a function need to use the & operator if the array is to be changed or modified? a. yes – arrays are never passed by reference b. no – arrays are automatically passed by reference

  26. 13. Write a simple for loop segment to output the following array: Int values[20];

  27. 13. Write a simple for loop segment to output the following array: Int values[20]; for(n = 0; n < 20; n++) cout << values[n];

  28. 14. If an integer array is partially initialized, the unspecified cells will be set to _____________________. a. zero (0) b. blanks c. nulls d. none of the above

  29. 14. If an integer array is partially initialized, the unspecified cells will be set to _____________________. a. zero (0) b. blanks c. nulls d. none of the above

  30. 15. Write a simple for loop segment to allow the user to input new values in the array of question 13.

  31. 15. Write a simple for loop segment to allow the user to input new values in the array of question 13. for(n = 0; n < 20; n++) cin >> values[n];

  32. 16. A loop where the exact number of repeats or repetitions is not known is called an __________________ loop. a. undefined b. ill-defined c. indefinite d. counted

  33. 16. A loop where the exact number of repeats or repetitions is not known is called an __________________ loop. a. undefined b. ill-defined c. indefinite d. counted

  34. 17. Write the section of code that could be used to input and sum a list of exactly 25 values.

  35. 17. Write the section of code that could be used to input and sum a list of exactly 25 values. count = 0.0; sum = 0.0; while(count < 25.0) { cin >> value; sum = sum + value; count = count + 10; }

  36. 18. Write a section of code that could be used to output YES if the variable cost is greater than 100.0 or output NO if cost is less than or equal to 100.0.

  37. 18. Write a section of code that could be used to output YES if the variable cost is greater than 100.0 or output NO if cost is less than or equal to 100.0.if(cost > 100.0) cout << “YES”; else cout << “NO”;

  38. 19. If the user is to enter a sentinel value at the end of an indefinite list of vaues, the programmer would use an ____________________ loop. a. indefinite b. undefined c. counted d. ill-defined

  39. 19. If the user is to enter a sentinel value at the end of an indefinite list of vaues, the programmer would use an ____________________ loop. a. indefinite b. undefined c. counted d. ill-defined

  40. 19. If the user is to enter a sentinel value at the end of an indefinite list of values, the programmer would use an ____________________ loop. a. indefinite b. undefined c. counted d. ill-defined

  41. 20. Draw a symbolic diagram or flowchart of a program segment that could be used to output the message PASS or FAIL for a given test score. Assume 65 and above is a passing score

  42. True Score>=65? False cout<<”PASS” cout<<”FAIL” False True Score>=65? cout<<“PASS” Cout<<“FAIL”

  43. 21. Which Boolean operator should be used in a condition to test if either variable a or variable b is true? _____________________. a. && b. ! c. == d. ||

  44. 21. Which Boolean operator should be used in a condition to test if either variable a or variable b is true? _____________________. a. && b. ! c. == d. ||

  45. 22. A good rule of thumb is always to place _____________________ around both choices of a two-choice if. a. [] b. () c. {} d. //

  46. 22. A good rule of thumb is always to place _____________________ around both choices of a two-choice if. a. [] b. () c. {} d. //

  47. 23. Which Boolean operator should be used in a condition to test if both variable a and variable b is true? a. && b. ! c. == d. ||

  48. 23. Which Boolean operator should be used in a condition to test if both variable a and variable b is true? a. && b. ! c. == d. ||

  49. 24. Consider the following for loop: for(n=0; n<10; n++) cout << “hello” << endl; How many different lines will the above loop produce? a. 9 lines b. 11 lines c. 10 lines d. 0 lines

  50. 24. Consider the following for loop: for(n=0; n<10; n++) cout << “hello” << endl; How many different lines will the above loop produce? a. 9 lines b. 11 lines c. 10 lines d. 0 lines

More Related