Home | | Programming and Data Structures I | Important Short Questions and Answers: Programming Fundamentals

Chapter: Programming and Data Structures

Important Short Questions and Answers: Programming Fundamentals

Programming and Data Structures - Important Short Questions and Answers: Programming Fundamentals

 

1. Define global declaration?

 

The variables that are used in more than one function throughout the program are called global variables and declared in outside of all the function that is before the main() function.

 

2. Define data types?

 

Data type is the type of data, that are going to access within the program. „C‟ supports  different data types



 

3.Define variable with example?

 

A variable is an identifier and it may take different values at different times of during the execution .

 

A variable name can be any combinations of 1 to 8 alphabets, digits or underscore. Example:

 

int a,b;

here a,b are variables

 

4. What is decision making statement?

 

Decision making statement is used to break the normal flow of the program and execute part of the statement based on some condition.

 

5.What are the various decision making statements available in C ?

If statement

 

if…else       statement

 

nested if statement

 

if…else       ladder   statement

 

switch statement

 

6. Distinguish between Call by value Call by reference.



7. What is an array?

 

An array is a collection of data of same data type. the elements of the array are stored in continuous memory location and array elements are processing using its index.

 

Example: int a[10];

 

Hereis an„aarray name.

 

8. What is two dimensional array?

 

Two dimensional is an array of one dimensional array. The elements in the array are referenced with help of its row and column index.

 

Example:

 

Int a[2][2];

 

9. Define is function?

 

Function are group of statements that can be perform a task. Function reduce the amount of coding and the function can be called from another program.

 

Example:

 

main()

 

{                                    fun()

-------                             {

 

fun();                             -------

--------                            }

 

}

 

10.What   are   the   various   looping   statements   available in ‘C’?

While statement

 

 Do….while   statement

For statement

 

11. What are the uses of Pointers?

Pointers are used to return more than one value to the function

Pointers are more efficient in handling the data in arrays

 

Pointers reduce the length and complexity of the program

 

They increase the execution speed

 

The pointers save data storage space in memory

 

12.What is a Pointer? How a variable is declared to the pointer?

 

  Pointer is a variable which holds the address of another variable.

 

  Pointer Declaration: datatype *variable-name;

 

  Example: int *x, c=5; x=&a;

 

 

13.What is the difference between if and while statement?

If

It is a conditional statement

If the condition is true, it executes some statements.

If the condition is false then it stops the execution the statements

 

While

It is a loop control statement

Executes the statements within the while block if the condition is true.

If the condition is false the control is transferred to the next statement of the loop.

 

14. Define pre-processor in C.

Preprocessor are used to link the library files in to source program, that are placed before the main() function and it have three preprocessor directives that are

Macro inclusion

 

Conditional inclusion

 

File inclusion

 

15. Define recursive function?

 

A function is a set of instructions used to perform a specified task which repeatedly occurs in the main program. If a function calls itself again and again , hten that function is called recursive function.

 

16.                    What   is   the   difference   between   while   and

 

The while is an entry controlled statement. The statement inside the while may not be executed at all when the condition becomes false at the first attempt itself.

 

The do …while is an exit controlled statement. The statements in the block are executed at least once.


 

 

17. Define Operator with example?


An operator is a symbol that specifies an operation to be performed on operands . some operators require two operands called binary operators, while other acts upon only one operand called unary operator.        

Example:    a+b    here a,b are operands and + is operator

 

18. Define conditional operator or ternary operator?

 

Conditional operator itself checks the condition and execute the statement depending on the condition. (a>b)?a:b if a is greater than b means the a value will be return otherwise b value will be return.

 

Example: big=a>b?a:b;

 

19. Compare of switch() case and nested if statement


 

20. What are steps involved in looping statements?

Initialization of a condition variable.

Test the control statement.

Executing the body of the loop depending on the condition.

Updating the condition variable.

 

 

20.            Define break statement?

 

the break statements is used terminate the loop. When the break statement is encountered inside a loop, the loop is immediately exited and the program continues with the statement immediately following the loop.

 

Example:              while(condition)

 

{

…………

 

If(condition)

 

break;

………

 

}  

 

22.            Define null pointer?

 

A pointer is said to be a null pointer when its right value is 0, a null pointer can never point to a valid data. For checking a pointer, if it is assigned to 0, then it is a null pointer and is not valid

 

Example:

 

int *a; int *b; a=b=0

;

 

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Programming and Data Structures : Important Short Questions and Answers: Programming Fundamentals |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.