CTSD Assignment
CTSD Assignment
Answer :1972
11. In the Testing & Debugging phase, we check whether the writtenCode in the ______ step is
solving the specified problem or not.
Answer :implementation
Answer :8 bytes
Answer: complier
Answer:8 bytes
Answer: logical
17. Main Function is the major section from where the ________ of theProgram begins. Answer:
excution
Answer: #
answer.
Int main() {
Printf(“Size of int: %lu bytes\n”, sizeof(int));
Printf(“Size of float: %lu bytes\n”,sizeof(float));
Printf(“Size of double: %lu bytes\n”, sizeof(double));
Printf(“Size of char: %lu byte\n”, sizeof(char);
Return 0;
}
31. What is the purpose of scanf() and printf() statement ? Write the Guidelines to use
scanf() and printf() functions in C language.
Answer :
In the C programming language, `scanf()` and `printf()` are functions used for input and
output, respectively.
1. `scanf()`: This function is used for input, allowing you to read data from the user or a
file. Its purpose is to receive data and store it in variables. Here are some guidelines for
using `scanf()`:
- Provide format specifiers that match the data you expect to read (e.g., `%d` for integers,
`%f` for floats).
- Ensure proper variable types and use the `&` operator to pass the variable’s address.
- Handle error cases where input doesn’t match the specified format.
- Avoid buffer overflow by specifying the maximum field width using format specifiers.
- Use format specifiers to format data in the output string (e.g., `%d` for integers, `%f` for
floats).
- Ensure the number and types of format specifiers match the arguments you pass.
- Handle formatting and alignment according to your desired output.
- Escape special characters using backslashes (e.g., `’\n’` for a new line).
37. Define variable. Explain the rules for constructing variables in C Language
Answer :A variable in C is named storage location in memory that holds a value. Rules for
constructing variables in C
38. Explain all phases of program development in C with suitable flow chart
Answer:
Answer :
1) Variable:A named storage location in memory that holds a values and can be modified
during program execution
2) Constant:A value that does not change during program execution and is assigned a
fixed value
3) Associativity:The order in which operators of the some precredence are allowed it can
be left to right or right to left
4) Precedence:The priority of operators with higher precedents are allowed first.
40. What are the formatted input and output functions? Explain with Examples.
I formatted input and output. Functions in C are used for reading and writing data Is
specific format. This function allows you to control the formatting of data while reading
from our. Writing to the console or files. Two commonly used functions for formatted input
and output are printf ()and scanf()
Int num=10;
Int input;
Scanf(“%d”,&input);
41. Explain with example, the various constants available in ‘C’ language.
Answer:
1)Integer constants:eg.123,-45
2)Floating constants:eg.3.14,-0.10
3)character constant:eg.A,5
Answer :
Logical operators :logical operators are used to perform logical operations (AND, OR, NOT)
on boolean expression. The return either ture or false
Ex:int a=1,b=0;
}
Bitwise operators :Bitwise operators are used to perform operation at the bit level. The
work with individuals bits of integer value for example, you can use and for bitwise or so on
ex:int x=5;//bimary is 0101
43. What is preprocessor directive? Explain #define and #include Preprocessor directives?
44. What is the valid range of numbers for int type of data?
Answer:
Valid range of int type :The valid range of int type in C may vary depending on the system
and Compiler. Being used. However in most system .The int type is a 32 bits integer. Which
can represents value in the range approximately -2,147,483,648 to 2,147,483,647 . This
range may be different on system with different. Word size are compiler .You can check the
specific range for your system range. The Limited. Header which provides constant like
intmin and int max