Shared Flashcard Set

Details

QUIZ 2 - PROGRAMMING FUNDAMENTALS
FLASHCARD FOR THE QUIZ 2 ON PROGRAMMING FUNDAMENTALS
53
Computer Science
Graduate
10/02/2016

Additional Computer Science Flashcards

 


 

Cards

Term
Whats a Variable?
Definition
is a storage location in a computer's RAM memory.
Term
What's another name given to variables?
Definition
an identifier, and it must always be given a DATA TYPE.
Term
What do we have to do first prior creating a variable?
Definition
We have to declare it, which means to specify its data type and its name.
Term
What does the the data type tells the computer?
Definition
it tells the OS how many bits of memory will be used to create the variable
Term
what's another name in which "creating variables" is known for?
Definition

"Variable binding"

 

when we declare a variable, we're binding the name of the variable to a particular memory location address.

Term
so..what's Variable binding?
Definition

a variable name, or identifier is a reference to a particular memory address.

 

When we create a variable, we are basically binding  the name of it to a particular memory location address.

Term
Mention three forms in which a variable name can start?
Definition

a variable name can start with:

  • with a letter
  • with an underscore
  • with a $ sign.
Term
What you should never use at the beginning of a variable name?
Definition
Numbers, otherwise it will result in a compile error,  you can place numbers at the end of variables name example number 3
Term
Whats some important info remember about the naming convention?
Definition
  • variables use regularly cammel back format starting always wiht lower case
  • JAVA is CASE-SENTITIVE. so armor would be different to Armor.
  • Names can be of any lenght
  • you can't use JAVA reserved words such as class, public or else.
Term
What's the ROT ( Rule of Thumb) of naming convention?
Definition

                 Variable names must be meaningful.                     so basically one should be able to infer what it represents by looking at the name.

Term
in Java, where are the program statements  contained?
Definition
Inside a .class file
Term
by convention how should CLASS NAMES be written?
Definition
they should always starts with  UPPER LETTER and then each new word should start with another Upper Letter . this is called TitleCase notation
Term
What does the Data Types tells the OS?
Definition

it tells the OS how many bites of memory  must be allocated for that variable.

 

additional your program uses the data type to interpret the data that its store there.

Term
What's a Data Type?
Definition
A data type is a how a computer language represents the various types of numbers and text characters we use in our physical world internally in the computer’s memory.

 

Term
Mention the 8 primitive Data Types:
Definition
  • byte
  • short
  • int
  • long
  • float
  • double
  • char
  • bolean
Term
What's the Char type:
Definition
oRepresents a single character:  ‘a’,’-’, ‘&’, ‘G’, ‘8’ (single quote marks around the character indicate it is a char data type)
Term
What's the int data type:
Definition
to represent a whole number i.e 1,2,3…
Term
What's the double data type:
Definition
represents a real or floating point number such as 25.24
Term
What's the Bolean data type:
Definition
holds either a true or false value.
Term
Mention some Object Data typeS:
Definition
  • String
  • Scanner
Term
What's a string data type:
Definition
This is actually an object data type that holds a string of alphanumeric characters i.e. “John Doe” or “123 Main Street”
Term
What's a Scanner datat ype:
Definition
this is an object data type that we will use to read data that is typed in by the user.
Term
Why are Primitive data types called Primitive?
Definition
Primitives don’t have any methods associated with them
Term
What's a method?
Definition
A method is just some lines of code that are put in a block and given a name. We can run ( or activate) this method by calling its method name in our code. 
Term
How many primitive data types are there in Java?
Definition
8
Term
What are the wrapper classes?
Definition
object data type equivalents for each of the primitive data types 
Term
There are two main types of Primitive Data types ,
Definition
  • Numeric data types
  • non-numeric data types
Term
What are the numeric data types?
Definition
  • byte
  • short
  • int
  • long
  • float 
  • double
Term
Which are the non-numeric data types?
Definition
  • Char
  • Bolean
Term
How much memory does byte store?
Definition
8 bits , it can also stored negative numbers
Term
how much memory does short can hold?
Definition
Short can hold to 16 bits
Term
how much memory can int stored?
Definition
int can stored 32 bits
Term
how much memory does long can store
Definition
long can store 64 bits
Term
how much memory does float can store?
Definition
float can store 32 bits
Term
how much memory does double can store
Definition
double can store 64 bits
Term
how much memory does char can store
Definition
it can store 16 bits
Term
how much memory does bolean can store?
Definition
8 bits, it can only store either true or false
Term
How is a floating point store in a computer?
Definition
as two separate parts,  called "mantissa" and "exponent"
Term
What's a constant in Java?
Definition
A constant represents a value stored in memory which will not change during the operation of the program.
Term
What's the naming convention for Constants?
Definition
ALL must be in Upper Case, if you have more than one word you can use underscores.
Term
How do you declare a constant?
Definition

you have to type the word "FINAL" prior the data type and the name of the constant it holds

 

final double IP = 0.6.

 

in the case of CONSTANTS you must declare it and initialize it in the same line of code, unlinke VARIABLE where you can declare it and then assigned the value.

Term
What's a data literal?
Definition
A. A data literal is an actual data value that appears in a program
Ex:    int age = 5;  // 5 is an integer literal

          char letter = ‘Z’; // ‘Z’ is a character literal

           

          age = age / 12 + 9;// 12 and 9 are integer literals


          double cash = 4.56// 4.56 is a floating point literal

Term
What does the "=" sign represents in java
Definition
zused to assign a data value to a variable in memory,  it basically means "gets"
Term
What's another name for the arithmetic operations?
Definition
binary operations!
Term
What does the % stands for in binary operations?
Definition
it represents the modulus division operator, zThis returns the remainder  from a division operation, rather than the quotient.
Term
zQ. What is modulus division useful for?
Definition
zone common use is to determine if a value is odd or even by doing a modulus division by 2 on the test value.

The answer of a modulus division operation is the REMAINDER value from a regular division operation. 

Term
What's the operator precedence in Java?
Definition

is the order in which the bynary operations are performed similar to BEDMAS,

 

1ST - BRAKETS

2ND - /, %, *

3RD -  + -

4TH =

Term
How can you test if two values are the same?
Definition

By using the equality operator ==

 

if(amount1 == amount2)

system.out.println("They are equal")

Term
How can we test if they are not equal?
Definition

using the !=

 

if(amount1 != amount2)

   System.out.print(“Values not equal”);
Term
What are the Unary Operators?
Definition

basically the + or - values.  

 

a numeric value is always positive by default so there's no need to 

Term
What the increment variable and how it's represented
Definition

it is represented as ++

 

and basically it adds "one" to another variable 

Term
What the decrement variable and how it's represented
Definition

it's represented as --

 

it substracts "one" from a variable

Term
What does TypeCasting stands for?
Definition
zConverts a value of one data type into a value of another data type (T!)

 

zNOTE: it is the value stored in the variable that gets converted, and not the variable itself.
Supporting users have an ad free experience!