Skip to main content

Posts

Showing posts with the label Questions Answer

Explain continue and break statement with program example

Answer:  C ontinue Statement : The continue statement skips some statements inside the loop. The continue statement is used with decision making statement such as if...else.

The main is a user-defined function. How does it differ from other user-defined function?

Answer: The main is an example of user-defined function. Printf and scanf belong to the category of library functions. We have also used other library functions such as sqrt, cos, strcat, etc. The main distinction between these two categories is that library functions are not required to be written by us whereas a user-defined function has to be developed by the user at the time of writing a program.

Describe the different types of string handling functions in C language with example

Answer: Different type of string handling function: Function Name Description strcat() Concatenates two strings. strcmp() Compares two strings. strcpy() Copies a string from source to destination. strlen() Returns the length of a srting. strlwr() Return upper case letter to lower case. strupr() Return lower case letter to upper case. Strrev() Reverse of a string. Strcat() function: The strcat() function joins two strings together.

What is an array ? What are the differences between an array and a structure ?

Answer: Array: An Array is a collection of the homogeneous (same type) elements stored under unique name. The elements are stored in the contiguous memory locations. The values in an array is called as ‘elements of an array’. These elements are accessed by numbers called as ‘subscripts or index numbers’. Arrays may be of any variable type. Array is also called as ‘subscripted variable’.

What is null statement ?

Answer:   A "null statement" is a statement containing only a semicolon; it can appear wherever a statement is expected. Nothing happens when a null statement is executed. The correct way to code a null statement is:

What is looping process ? Distinguish between counter-controlled loops and sentinel-controlled loops.

Answer:  A looping process is the process which cheek sum condition steps by step. A looping process in general would include the following steps_ i. Setting and initialization of a condition variable. ii. Execution of the statements of the loop. iii. Test for a specified value of the condition variable for execution of the loop. iv. Increasing or updating the condition variable.

Distinguish different from of main() functions in C language.

Answer: C permits different forms of main statement. The following forms are allowed:             (i) main()             (ii) main(void)             (iii) int main()             (iv) void main()             (v) void main(void)             (vi) int main(void)