6 explain the naming rules for creating variables and then


1. Which of the following is false?

  • All elements of the array have the same data type.
  • All elements in an array have the same name.
  • All elements in an array have the same subscript.
  • The first element of the array has a subscript of zero.

2. Typically, the first item in defining a function is _____.

  • an open curly brace "{"
  • passing an argument
  • passing the function
  • naming the function

3. What is a variable's scope?

  • The length of time the variable is in existence
  • Determines who can see and access the variable
  • It is the length of time the variable is in existence, AND determines who can see and access the variable.
  • None of these

4. Float and double variables should not be used _____.

  • as counters
  • to perform mathematical calculations
  • as approximate representations of decimal numbers
  • for applications when precision is required

5. Consider the following segment of code.

if(apple != Orange)
cout<<"You got Oranges!"cout<<"You got Apples";
cout<<"The end of the program is reached.";

What error can you identify?

  • A double quotation mark was incorrectly inserted.
  • You cannot compare apples to oranges.
  • Assumes indentation has a logical purpose
  • No error

6. Explain the naming rules for creating variables, and then provide three examples using the data types int, double, and char and assign values to them.

7. What is the advantage of using the conditional operator?

8. Create a C++ program that declares, initializes, and outputs the values contained in a two-dimensional array

9. Create a code segment that defines a class definition for a student. Include at least two properties and two methods. Also explain the reason why there is a public and private section associated with class definitions.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: 6 explain the naming rules for creating variables and then
Reference No:- TGS01232861

Now Priced at $45 (50% Discount)

Recommended (99%)

Rated (4.3/5)

A

Anonymous user

2/9/2016 7:47:32 AM

This assignment related to true and false as well give appropriate answer of each question. 1. Which of the subsequent is false? i. All elements of the array have the same data type. ii. All elements in an array have the same name. iii. All elements in an array have the same subscript. iv. The first element of the array has a subscript of zero. 2. Typically, the 1st item in essential a function is _____. i. an open curly brace "{" ii. Passing an argument iii. Passing the function iv. Naming the function