Please go though C Programming #04: Datatypes and Variable before taking this quiz.
Question 1: What are the basic data types that C supports ?
Show Answer
Character, Integer, Float, Double.
Question 2: Is string a native data type in C ?
Show Answer
NO
Question 3: what is following statement called in "int a; "?
Show Answer
Variable Declaration.
Question 4: Where are variables stored ?
Show Answer
RAM.
Question 5: Is it valid name "int 007_Agent;"
Show Answer
NO, Variables should not start with number.
Here is the complete list of rules that has to be followed for valid Variable name in C.
Question 6: What are the three things associated with variable ?
Show Answer
Hence associated with each variable there is following associated.
- Name
- Data type
- Memory address
Question 7: Why variables having a name ?
Show Answer
Since data are stored in memory. Each data have memory address in RAM. we could have used this memory address directly. if we had done like this program would have become unreadable, with all address in them. It would be very hard to track which address has which data. Hence computer engineers have this address a name and called it variable. Hence, A variable is the name for a place in the computer's memory where you store some data.
Question 8: Why variables have data type ?
Show Answer
For example to represent char we use ASCII, ASCII chart has 128 characters. Hence we can represent in 7 bits (2^7 = 128). While a integer number 3421 in decimal, (D5D in hex ) can be represented in 12 bits. Hence each data takes different amount of memory, Hence type tells us how much amount of memory is required. NOTE: size of char variable in not 7 bit in C and size of integer is not 12 bit in C.
Question 9: What is size of integer in 32 bit Computer ?
Show Answer
4 byte.
Question 10: what is use of sizeof operator ?
Show Answer
It is used to find the sizeof any variable/constant.
No comments :
Post a Comment