Programming Basics Flashcards

1
Q

Two types of scoping

A

Static and Dynamic

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

When a function is called, what operation occurs in stack?

A

PUSH

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

When a function is over, what operation occurs in stack?

A

POP

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

Within the same function, are multiple variable of the same name allowed?

A

NO

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

Where are local variables stored?

A

Stack

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

Where are global variables stored?

A

Static area

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

3 parts of main memory

A

Stack, Heap, Static area

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

To store in heap area , which keyword is used?

A

malloc

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

Which part of main memory is least in size?

A

Static area

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

Default value in static area?

A

0

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

Default value in stack area?

A

garbage

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

Global variable are allocated memory at which time?

A

Compile time

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

Static memory allocation allocates memory at?

A

Compile time

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

Static memory allocation is also known as?

A

Early Binding

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

In dynamic memory allocation, memory estimated at?

A

Runtime

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

Static can be mapped to?

A

Compiler

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

Dynamic can be mapped to?

18
Q

&

A

Reference operator

19
Q

*

A

Dereference operator

20
Q

Local variable memory estimated at?

21
Q

Identify error : variable with same name declared twice in the same function

A

Multiple declaration error

22
Q

Identify error: operation b/w two variable of different type

A

Type mismatch error

23
Q

Identify error : variable used without declaration

A

Undeclared variable error

24
Q

Solution of scope problem

A

Static scoping and Dynamic scoping

25
Who handles static scoping?
Compiler
26
Who handles dynamic scoping?
Processor
27
Static scoping?
If no local, take global
28
Dynamic Scoping?
Go to the prev functions, if variable not found in any function, use global variable's value
29
Which scoping is more difficult to implement?
Dynamic
30
Default scoping technique?
Static
31
When does static scoping give error?
If variable not present local and also not global then error
32
When does dynamic scoping give error?
If variable is not present in any function and also not global
33
In worst case , dynamic scoping prints what value of variable?
Global value
34
Why indexing of array start from 0?
So that no time is taken in calculating offset value
35
int a=26;
Initialisation
36
int a;
Declaration
37
a=26;
Modification
38
If any value is passed to a function suppose int D(int a, int b) then what happens?
Then function D makes its local copies of a and b and stores the passed value in it.
39
What is the difference b/w initialization, declaration and modification
Initialization and declaration creates memory whereas modification does not
40