Wednesday, 1 May 2019

ch- function

function

Identify the invalid declaration: 
A) int &p; 
B) int *p[10]; 
C) int **p; 
D) int *p[ ];

A function cannot be defined inside another function. FALSE
Goto can be used to jump from main function to other function. FALSE
The default parameter passing mechanism is call by value. TRUE
The expressions int fun(int arr[]); and int fun(int arr[2]); are same. TRUE
There can be two return statements inside a function. FALSE
Function can be called either by value or reference TRUE 
2.2 A function cannot be defined inside another function. TRUE

void (*ptr)(int); ptr is pointer to int that converts its type to void



The value obtained in the function is given back to main by using __return_____ keyword.



4.4 ___gets_____ function that is most appropriate for reading in a multi-word string.

Default return type of any user-defined function is __integer______. 

What is call by value and call by reference ? Write a program to swap two numbers using call by value

What is function? Explain uses of function.Also explain decalarion function call and function definition with example. 

What is a difference between pass by value and pass by reference? 

b) Write a funtion in C to print event numbers from 1 to 100

Write down three different methods used for referencing multiple values from a function. 

Write a function to display the multiplication table of the number.

 c) Write a function which accepts an array of size n containing integer values and returns average of all values. Call the function from main program. 

Using a switch statement, write a function to count the number of vowels and number of blanks in a character array passed to it as an argument.  

Explain the concept of recursion with example. 

No comments:

Post a Comment

Index

ch-1 Introduction