Lecture 1: C Flashcards

1
Q

programming quality standards are?

A
  • correctness, or whether our code solves our problem correctly
  • design, or how well-written our code is, based on how efficient and readable it is
  • style, or how well-formatted our code is visually
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is compiler?

A
  • Acompiler is a program that can convert one language to another, such as source code to machine code:
    <img></img>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In C,mainachieves a similar effect as the Scratch block which is

A

when green flag clicked

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

there are a number of commands (Tirminal window) we might use llike:

A
  • cd, for changing our current directory (folder)
  • cp, for copying files and directories
  • ls, for listing files in a directory
  • mkdir, for making a directory
  • mv, for moving (renaming) files and directories
  • rm, for removing (deleting) files
  • rmdir, for removing (deleting) directories
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

bool is a type of data which represents

A

a Boolean expression of eithertrueorfalse

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

Char is a type of data which represents

A

a single character likeaor2

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

Double is a type of data which represents

A

a floating-point value with more digits than afloat

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

float is a type of data which represents

A

a floating-point value, or real number with a decimal value

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

int is a type of data which represents

A

integers up to a certain size, or number of bits

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

long is a type of data which represents

A

integers with more bits, so they can count higher than anint

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

String is a type of data that represents

A

array of characters

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

Forprintf, too, there are different placeholders for each type of data, called:

A

format codes:

  • %cfor chars
  • %ffor floats or doubles
  • %ifor ints
  • %lifor long integers
  • %sfor strings
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

//

A

comments

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

how many bits are include in int?

A

int uses 32 bits, which can only contain about four billion different values (2m psitive numbers & 2m negative numbers)

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

How many equals sings should used to compare two values in C?

A

== (2)

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

While Loops in C looks like?

A

while (true)
{
printf(“meow\n”);
}

Awhileloop repeats over and over as long as the expression inside is true, and sincetruewill always be true, this loop will repeat forever.

17
Q

For loops and the difference between the two types (while, for)

A

the variable created within a for loop will only be accessible within the loop. In contrast, the variablewe created outside the while loop will still be accessible after the while loop finishes.

18
Q

\n

A

new line

19
Q

When will the date change?

A

In 2038, we’ll run out of bits to track time, since many years ago some humans decided to use 32 bits as the standard number of bits to count the number of seconds since January 1st, 1970. But since a 32-bit integer can only count up to about 2billion, in 2038 we’ll also reach that limit.