110 - Software Development Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is the print function in C?

A

Printf()

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

How to start a program?

A
  1. Decompose the problem into a small number of steps

2. Then again into subsets until you can start to program

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

What does this do?

for (i=0; i<10; i++)
{
print(“Hi!\n”);
}

A

It is a for loop that allocated the value of “0” to the variable called “i”. Then for states “for as long as i is less than 10, print “Hi” then add 1 each time

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

What does “%d” mean?

A

Print an integer

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

What does “scanf()” do?

A

It gets the user input

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

Always remember to do what?

A

Add meaningful comments to clarify what your code is trying to achieve

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

What does Camelcase look like?

A

camelCase

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

What is an Array?

A

Arrays provide a way for storing multiple instances of the same data type

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

What index is the 2nd place in the array and why?

A

Index 1 because the indexes start at index 0

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

What do functions do?

A

Create reusable units of code to help avoid repetition by factoring our common elements

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

What does “rand()” do?

A

It generates a random number.

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

Function definitions have what form?

A

Direct-declarator (parameter-type-list)

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

Functions DO NOT return what?

  1. A union
  2. An arithmetic type
  3. A function
  4. A structure
  5. An array
  6. A pointer
  7. A void

(Pick two)

A

A function and an array

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

In C, functions may have side effects (e.g. printing) what is not always needed to prevent this?

A

The return value

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

What does “void” mean?

A

It means that nothing is returned

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

What do you need at the beginning of every C program?

A

Int main()

17
Q

What does it mean when you say x = y?

A

You’re copying the contents of “y” into “x”

18
Q

What is a pointer?

A

A pointer is a variable that contains the address of a variable

19
Q

What does “int *p = &x; mean if:

int x = 65; (index 3)
int y = 32; (index 1)

A

It is pointing to the place in member where int x is. In this case , the answer is index 3

20
Q

What does p = &x; do?

A

It puts the address of box x into p

21
Q

What does *p = 8; do?

A

Puts the value 8 into the box pointed to by p

22
Q

What does “printf(“%d\n”, marks[0] if

7 | marks[0] = 55;
8 | marks[1] = 65;
9 | marks[2] = 70;

A

Print the integer that in is “marks[0]”

23
Q

What’s the difference between;

printf(“%d\n”, marks);

and

printf(“%d\n”, *marks);

A

The first statement prints out the integer that is located in “marks” and the second statement prints out the integer that “marks” is pointing to

24
Q

Why is a “&” needed before the variables when using “scanf”?

A

It needs to modify the variable

25
Q

What is a string?

A

It is text or a sequence of characters

26
Q

How many spaces in memeber does char s[] = “hello”; and why?

A

It’s 6 elements long because it also null byte “\0”. This tells the computer when to stop

27
Q

How do you calculate the length of a string?

A

Using the “strlen()” function. Start at the beginning and check to see if you’ve reached the null byte