0% found this document useful (0 votes)
5 views

C ans key

answer key for end sem

Uploaded by

santhini.t
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

C ans key

answer key for end sem

Uploaded by

santhini.t
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

3. Q:1 Define Branching? Name its different control statements?

Ans: Those control statements which are used for decision making purpose or for making
multi-way selection in the program are called Branching Statements. These statements
choose to follow one branch or another during execution in the program. Branching
statements are of the following two types:
 Conditional Control Statements (if else)
 Multiway Conditional Control Statement (switch case)

 How to declare empty array in C?


 To create an empty array in C, you need to declare an array variable with a
size of 0 or dynamically allocate memory for the array. datatype
array_name[0]; In C, declaring an array with a size of 0 is legal, but it doesn't
allocate any memory for the array elements. It effectively creates an array
with no elements.
How to declare empty array in C?

To create an empty array in C, you need to declare an array variable with a size of 0 or dynamically
allocate memory for the array. datatype array_name[0]; In C, declaring an array with a size of 0 is
legal, but it doesn't allocate any memory for the array elements. It effectively creates an array with
no elements.

3. Write some properties and advantages of user defined functions in C? Ans: Properties of Functions
- Every function has a unique name. This name is used to call function from “main()” function. - A
function performs a specific task. 3 Q&A for Previous Year Questions Subject: Computer
Programming(B.Tech. I Year)
--------------------------------------------------------------------------------------------------------------------------------------
---- - A function returns a value to the calling program.

What are recursive functions give an example?

Recursive Functions | Meaning & Examples - Lesson | Study.com

Recursive functions are calculated by going backwards until the base case is reached. Following the
above recursive function for evaluating a factorial of 4, for example, the function states the factorial
of 4 is equal to 4 times the factorial of 4 minus 1, so the factorial of 4 is 4 times the factorial of 3.

How to pass pointers through functions in C?


To pass a pointer to a function in C, you can define a function parameter of pointer
type and then pass the address of the variable you want to point to. Here's an
example: #include <stdio. h>24 Aug 2022
Which functions is used to open a file in C?
The fopen() method in C is a library function that is used to open a file to perform
various operations which include reading, writing, etc. along with various modes.23
Jun 2023
What are the input and output functions of string in C?
C provides two basic ways to read and write strings. input/output
functions, scanf/fscanf and printf/fprintf. Second, we can use a special set of string-
only functions, get string (gets/fgets) and put string ( puts/fputs ).
S.NO TYPE CASTING TYPE CONVERSION

1. In type casting, a data type is converted into another data type by a programmer using
casting operator. Whereas in type conversion, a data type is converted into another data type
by a compiler.

2. Type casting can be applied to compatible data types as well as incompatible data types.
Whereas type conversion can only be applied to compatible datatypes.

3. In type casting, casting operator is needed in order to cast a data type to another data type.
Whereas in type conversion, there is no need for a casting operator.

4. In typing casting, the destination data type may be smaller than the source data type, when
converting the data type to another data type. Whereas in type conversion, the destination data
type can’t be smaller than source data type.

5. Type casting takes place during the program design by programmer. Whereas type
conversion is done at the compile time.

6. Type casting is also called narrowing conversion because in this, the destination data type
may be smaller than the source data type. Whereas type conversion is also called widening
conversion because in this, the destination data type can not be smaller than the source data type.

7. Type casting is often used in coding and competitive programming works. Whereas
type conversion is less used in coding and competitive programming as it might cause incorrect
answer.

8. Type casting is more efficient and reliable. Whereas type conversion is less efficient
and less reliable.

You might also like