• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/12

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

12 Cards in this Set

  • Front
  • Back

What does this code do?


Console.WriteLine(x)

Displays whatever is in the parentheses. In this case, it will show whatever is stored in the variable, x.

What does this code do?


name = Console.ReadLine();

Asks for user input and stores it in the variable, "name".

What does this code do?


Console.WriteLine("A" + a);

Concatenates "A" and whatever is stored in the variable, "a", and displays it on screen. For example, if "a" contained the string, "elephant", it would say "Aelephant".

What does this code do?


b = a

Assigns the string "a" to the variable "b". Note that "b" must be declared and must be declared to be a string before it can be assigned.

What is wrong with this code?


var name;

var is used to declare a variable and allows the program to select the variable type that makes the most sense. However, because this line doesn't assign anything to the variable on the same line, it doesn't know what type to declare it as.


A fix like this would correct it and declare it as an int variable:


var name = 3;

What type of function is this?


int[] a = { -5, 2, 8, 16};

Array function

What is this code called?


int x;

Variable declaration

What is this code called?


x = 2

Variable assignment

What is the name of the class that all C# programs must have?

Main

Is this allowed?


int a = 'a';

Yes. Using single quotes defines 'a' as a char character type. In binary, all characters are assigned a number. For 'a', it is 97. The integer, a, will be 97.

What does this code do?


Console.Write("\t1");

The "\t" inserts a tab. This will display a 1, tabbed over to the right.

What does this code do?


char a = (char)97;

Converts 97 to a character. In this example, "a" would be the character 'a' because 97 is the number assigned to "a" on an ASCII/Unicode table.