STRUCTURED PROGRAMMING Flashcards

1
Q

What are 4 ways to write functions in C?

A
  • functions with no return value
  • functions with return values
  • functions with no parameters
  • functions with one or more parameters
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. what is the size of an integer in C
  2. what is the size of a character in C
A

Integers:
32 bits -> 4 bytes
64 bits -> 8 bytes

Characters:
32bits -> 1 byte
64bits -> 1 byte

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

What is a variable?

A

It is a named location in memory, that holds a value

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

What is a datatype?

A

A datatype categorization that determines what type of values a variable can hold and what operations can be peformed on said values

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

What is the defrence between a call by value and a call by reference?

A

Both have to do with function paramenters, with call by value the function takes a value as input but performs operations on a copy of that value, hence the original value or variable is unchanged

With call by refrence the variable takes as parameter the reference of a value/variable (datatype paramname) and any operations done a permenent of the original value. any time the value is used within the fuction we write a * infront of it, indication that it is a reference

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

How do you calculate average marks with coeficients?

A

Sum of all marks multiplied by their coeficients divided by the sum of all coeficients

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