Basic Definitions Flashcards

1
Q

What are variables?

A

Variables are the user defined names given to a memory location which is used for storing data.

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

What are datatypes?

A

Datatypes specify the type of data a variable can store.

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

What are format specifiers?

A

Format specifiers are used to define the type of data to be displayed.

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

What are constants?

A

Constants are names given to variables whose value can’t be changed.

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

What are operators?

A

Operators are symbols used to perform specific operations on operands.

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

Name the arithmetic operators.

A

+plus
-minus
*multiply
/divide
&modulus
++increment
–decrement

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

Name the relational operators.

A

< less than
> greater than
<= less than or equal to
>= greater than or equal to
== equal to
!= not equal to

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

What are loops? Name the different types of loops.

A

Loops are used to repeat a block of code until the specified condition is met.

  • for loops
    for(initialization; condition; updation){
    // code to be executed;
    }
  • do-while loops
    do{
    // code to be executed
    } while (condition);
  • while loops
    while(condition){
    // code to be executed;
    updation;
    }
  • nested loops
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are if statements?

A

If statements are decision-making statements that executes a block of code if the condition is met.

if(// condition){
// code to be executed
}

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

What are switch statements?

A

A more efficient way to using many else if statements.

switch(// name of variable){
case 1;
// code to be executed
break;
case 2;
// code to be executed
break;
default: // on the last case
}

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

What is a function?

A

A block of code which only runs when it is called.

void functionName(){
// code to be executed
}
functionName() // to call the function

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

What is the difference between arguments and parameters?

A

Arguments
- the values sent to the function
- written at the bottom ()
functionName(// variable)

Parameters
- the values received by the function when its called
- written at the top (in the function)
void functionName(// datatype variable)

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

What is the difference continue and break?

A
  • Continue skips the rest of the code & forces the next iteration of the loop
  • Break exits out of a loop or a switch completely once the condition is met
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Name the logical operators and explain them.

A

&&Logical AND (returns true only if all the conditions are true)

||Logical OR (returns false only if all the conditions are false)

!Logical NOT (returns TRUE when condition
is FALSE, returns FALSE when condition is TRUE)

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

What is an array?

A

It is a data structure that can store many values of the same data type.
// datatype variable[size] = {value, value};
// to access
// name of variable [index number]

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

What is a 2D array?

A

It’s a collection of data elements arranged in a grid-like structure with rows and columns.
// datatype variable[number of rows / arrays] [numbers of columns / values]= {{value, value},{value value}};

17
Q

What is a structure?

A
  • collection of different data types which the compiler allocates the memory for each member
  • size of structure is greater than or equal to the sum of the size of its members
  • individual member can be accessed at a time

struct nameOfstruct{
data_type member_name1;
data_type member_name2;
}

18
Q

What is a union?

A
  • collection of different data types in the same memory location
  • the size of union is the same size as the biggest member
  • only one member can be accessed

union nameOfunion{
data_type member_name1;
data_type
member_name2;
}

19
Q

What is a pointer?

A

It is used to store the memory address of other variables, functions or other pointers.

20
Q

What are the different file operations?

A
  • fopen() to create a new file / open existing file
  • fclose() to close a file
  • fscanf() or fgets to read a file
  • fprintf() or fputs() to write into a file