C Flashcards

1
Q

What is an int and how many bytes does it have

A

An int is a integer data type used for variables, and it has 4 bytes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an unsigned int and how does it relate to regular int?

A

It is a qualifier that doubles the positive values available for int data types and removes the negative values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a char and how many bytes does it include?

A

Char is a character data type that includes up to 8 bits or 1 byte and stores a single character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is ASKI and how does it relate to char?

A

ASKI is a that tells what number related to what character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a float and how many bytes does it take up?

A

A float is a decimal or floating data types in variables. Additionally, they take up 8 bytes or 64 bits. These are considered real numbers and allow for more precise numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is void?

A

Void is a type rather than a data type and can be used as a place holder. If used as a return value, it does not return anything. Void can also be used as a function argument.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is bool?

A

include<cs50.h> to include bool type variables in C.</cs50.h>

A boolean value data type that can hold either true or false.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is string

A

include <cs50.h> to utilize string types in C</cs50.h>

String is a text data type that includes characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are structs and typedefs?

A

They allow you to create your own data types and will be discussed later in the course.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you define a variable?

A

Nude the data type and the variable name, ending in a semi-colon.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Can you define multiple variables on the same line, and if so, how?

A

Yes, integers of the same type can be defined on the same line with their names separated by commas.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is one good design tip for defining variables?

A

Oy define them when you need them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you use variables in your code?

A

Include the variable name, the assign operator, and the value, followed by a semi-colon.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the assign operator?

A

The equal sign

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the arithmetic operators in C?

A

+, -, *, and /

Additionally, the modulus operator is %

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How can an operator be used with a variable and assign operator?

A

They can be placed before the assign operator to add, subtract, multiply, or decide that variable by the number that follows, or add ++ or - - after the variable to do the same thing for those two operators

17
Q

For a boolean variable, what values equal true and false?

A

0 equals false and all other numbers equal true.

18
Q

What are boolean expressions?

A

And, or, and not are logical operators and are used in boolean expressions to compare information.

19
Q

What is the or operator and when is it true?

A

|| and it is true when one or both are true.

20
Q

What is the and operator and when is it true?

A

&& and it is true when all are true.

21
Q

What is the not operator and when is it true?

A

! And it is true when x is false

22
Q

What are relational operators and how are they used?

A

Relational operators are <, >, =, <=, >=, != and they are used to compare data.

23
Q

What is the switch loop?

A

A loop with cases

24
Q

What does a do while loop do?

A

It runs one time before checking the conditional.

25
Q

What does the for loop do?

A

Repeat a specified amount of times

26
Q

What is a GUI?

A

It is a graphical user interface

27
Q

What is the Ls command and what does it do?

A

This list command. It lists the contents of the current directory

28
Q

What is cd and what does it do?

A

Cd is current directory and it changes the current directory to the directory you specify using cd directory

The current directory is represented by a single period and the parent directory is represented by a two periods

29
Q

What is pwd and what does it do?

A

It is the print working directory and it allows you to determine the name of the present directory.

30
Q

What does Ctrl l do?

A

Clears the terminal screen

31
Q

What is mkdir and what does it do?

A

It creates a new directory

32
Q

What is cp and what does it do?

A

Cp is the copy command and it copies the following file to the following new file

(cp oldFileName newFileName)

33
Q

What does -r do?

A

Following cp, it copies an entire directory

34
Q

What does rm mean and what does it do?

A

Rm is remove and it deletes the following file

35
Q

What is -f and what does it do?

A

It is force and following rm, it does not check that you want to remove a file

36
Q

What is mv and what does it do?

A

It moves a file/changes it’s name rather than copying it and removing the original

37
Q

Scope

A

Inside current curly braces