Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CSCI 105 Spring, 2009 Quiz 2: Data Types and Variables, Quizzes of Computer Science

A surprise quiz for the csci 105 introduction to computer programming course, focusing on data types, variables, and their proper usage. The quiz consists of multiple-choice questions covering topics such as data types, variable declaration, initialization, and naming conventions.

Typology: Quizzes

Pre 2010

Uploaded on 08/07/2009

koofers-user-ihg
koofers-user-ihg 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSCI 105 Introduction to Computer Programming Spring, 2009
Surprise Quiz #2
20 Points
MULTIPLE CHOICE:
1. This data type is used to hold single characters such as ‘3’, ‘W’, or ‘$’.
a) bool b) char c) double d) float e) int ab) long ac) string
2. This data type is used to hold integers numbers whose magnitude is larger than 2 billion.
a) bool b) char c) double d) float e) int ab) long ac) string
3. This data type is used to hold integers numbers whose magnitude is smaller than 2 billion.
a) bool b) char c) double d) float e) int ab) long ac) string
4. This data type is used to hold multiple-character items such as “Bob Smith” or “Forth Worth, TX”.
a) bool b) char c) double d) float e) int ab) long ac) string
5. This data type is used to hold either the value true or false.
a) bool b) char c) double d) float e) int ab) long ac) string
6. This data type is used to hold decimal numbers that need more than 7 digits of accuracy or have a range
larger than -45 to +38 for the exponent.
a) bool b) char c) double d) float e) int ab) long ac) string
7. This data type is used to hold decimal numbers that do not need more than 7 digits of accuracy nor have a
range larger than -45 to +38 for the exponent.
a) bool b) char c) double d) float e) int ab) long ac) string
8. Which of the following would produce a syntax error?
a) string hoursWorked;
b) const double ANNUAL_SALARY = 40000;
c) int age = 30;
d) battingAverage float;
e) double HoUsEpAyMeNt;
9. Which of the following only defines a variable using proper naming convention?
a) string hoursWorked;
b) const double ANNUAL_SALARY = 40000;
c) int age = 30;
d) battingAverage float;
e) double HoUsEpAyMeNt;
10. Which of the following defines a variable and initializes that variable?
a) string hoursWorked;
b) const double ANNUAL_SALARY = 40000;
c) int age = 30;
d) battingAverage float;
pf3

Partial preview of the text

Download CSCI 105 Spring, 2009 Quiz 2: Data Types and Variables and more Quizzes Computer Science in PDF only on Docsity!

CSCI 105 Introduction to Computer Programming Spring, 2009 Surprise Quiz # 20 Points MULTIPLE CHOICE:

  1. This data type is used to hold single characters such as ‘3’, ‘W’, or ‘$’. a) bool b) char c) double d) float e) int ab) long ac) string
  2. This data type is used to hold integers numbers whose magnitude is larger than 2 billion. a) bool b) char c) double d) float e) int ab) long ac) string
  3. This data type is used to hold integers numbers whose magnitude is smaller than 2 billion. a) bool b) char c) double d) float e) int ab) long ac) string
  4. This data type is used to hold multiple-character items such as “Bob Smith” or “Forth Worth, TX”. a) bool b) char c) double d) float e) int ab) long ac) string
  5. This data type is used to hold either the value true or false. a) bool b) char c) double d) float e) int ab) long ac) string
  6. This data type is used to hold decimal numbers that need more than 7 digits of accuracy or have a range larger than -45 to +38 for the exponent. a) bool b) char c) double d) float e) int ab) long ac) string
  7. This data type is used to hold decimal numbers that do not need more than 7 digits of accuracy nor have a range larger than -45 to +38 for the exponent. a) bool b) char c) double d) float e) int ab) long ac) string
  8. Which of the following would produce a syntax error? a) string hoursWorked; b) const double ANNUAL_SALARY = 40000; c) int age = 30; d) battingAverage float; e) double HoUsEpAyMeNt;
  9. Which of the following only defines a variable using proper naming convention? a) string hoursWorked; b) const double ANNUAL_SALARY = 40000; c) int age = 30; d) battingAverage float; e) double HoUsEpAyMeNt;
  10. Which of the following defines a variable and initializes that variable? a) string hoursWorked; b) const double ANNUAL_SALARY = 40000; c) int age = 30; d) battingAverage float;

e) double HoUsEpAyMeNt;

  1. Which of the following defines a variable but uses poor naming convention? a) string hoursWorked; b) const double ANNUAL_SALARY = 40000; c) int age = 30; d) battingAverage float; e) double HoUsEpAyMeNt;
  2. Which of the following defines a constant? a) string hoursWorked; b) const double ANNUAL_SALARY = 40000; c) int age = 30; d) battingAverage float; e) double HoUsEpAyMeNt;
  3. After the following instruction is executed, what will be the value of X? X = 3 + 4 * 5; a) 1 b) 2 c) 2.25 d) 3 e) 8 ab) 18 ac) 23 ad) 35 ae) 36 bc) 216 bd) none of the above
  4. After the following instruction is executed, what will be the value of X? X = 7 + 8 + 9 / 3; a) 1 b) 2 c) 2.25 d) 3 e) 8 ab) 18 ac) 23 ad) 35 ae) 36 bc) 216 bd) none of the above
  5. After the following instruction is executed, what will be the value of X? X = 9 / 4; a) 1 b) 2 c) 2.25 d) 3 e) 8 ab) 18 ac) 23 ad) 35 ae) 36 bc) 216 bd) none of the above
  6. After the following instruction is executed, what will be the value of X? X = 9 / 4.0; a) 1 b) 2 c) 2.25 d) 3 e) 8 ab) 18 ac) 23 ad) 35 ae) 36 bc) 216 bd) none of the above
  7. After the following instruction is executed, what will be the value of X? X = 9 % 4; a) 1 b) 2 c) 2.25 d) 3 e) 8 ab) 18 ac) 23 ad) 35 ae) 36 bc) 216 bd) none of the above
  8. After the following instruction is executed, what will be the value of X? X = Math.Pow(6,3); a) 1 b) 2 c) 2.25 d) 3 e) 8 ab) 18 ac) 23 ad) 35 ae) 36 bc) 216 bd) none of the above
  9. To convert information from a textbox TextBox1 to a decimal number unitPrice , you should use: a) unitPrice = Convert.ToInt32 (TextBox1.text); b) unitPrice = Convert.ToDouble (TextBox1.text); c) TextBox1 = Convert.ToInt32 (unitPrice); d) TextBox1 = Convert.ToDouble (unitPrice);
  10. Which of the following is not an attribute or directive associated with a TextBox? a) Clear b) Focus c) Gradient d) TabStop e) Visible Extra Credit Super Mega Bonus Question:
  11. Including the title page and the end-of-chapter projects, how many pages are in Chapter 3 of your CSCI textbook?