2 Data Types And Constants

C Programming · Unit 2

Data Types and Constants

Exam-focused notes for Data Types and Constants (C Programming, BIT102): what the TU syllabus asks and how it has actually been tested, with 6 solved past questions from this unit.

What this unit covers

  • Basic data types and their ranges
  • Constants and constant declaration
  • Type conversion and casting
  • Sizeof operator
  • Conversion specifiers

Conversion specifiers

20815 marks

What are conversion specifiers? Explain the compilation of C program in brief. [2+3]

--- Conversion specifiers are special format codes used inside printf() and scanf() functions to specify the type and format of data to be printed or read. They always begin with a percent sign (%). Specifier Data Type Example ------------------------------...

Full solved answer →
20805 marks

What are conversion specifiers? Explain the basic structure of a C program. [5]

--- Conversion specifiers are special format codes used inside printf() and scanf() functions to specify the type and format of data to be printed or read. They always begin with a percent sign (%) followed by a character that indicates the data type. Speci...

Full solved answer →

Basic data types and their ranges

20815 marks

What is constant? Explain basic data types in C programming along with their range. [1+4]

--- A constant is a fixed value that does not change during the execution of a program. Once defined, its value remains the same throughout the program. Example: --- C provides several fundamental (basic) data types to store different kinds of data. These a...

Full solved answer →
20795 marks

How keyword is different from Variables? Discuss Basic data types with its ranges. [5]

Aspect Keywords Variables ----------------------------- Definition Reserved words predefined by the programming language Named memory locations used to store data Purpose Have special meaning and perform specific functions in the language Hold values that c...

Full solved answer →
207810 marks

What different data types available in C along with their respective range?Write a program to check whether a given integer is palindrome or not.[5+5]

(a) Data Types in C A data type defines the type of data a variable can hold, the amount of memory allocated, and the operations that can be performed on it. Data Type Size Range --------- char 1 byte -128 to 127 unsigned char 1 byte 0 to 255 int 2 or 4 byt...

Full solved answer →

Type conversion and casting

2081.25 marks

What is the task of sizeof and comma operator? Discuss about type conversion. [5]

--- The sizeof operator is a compile-time unary operator that returns the size (in bytes) of a variable or data type. Syntax: Tasks of sizeof: - Determines the number of bytes occupied by a data type or variable in memory. - Helps write portable programs (s...

Full solved answer →