C Programming · Unit 1
Fundamentals of C Programming
Exam-focused notes for Fundamentals of C Programming (C Programming, BIT102): what the TU syllabus asks and how it has actually been tested, with 9 solved past questions from this unit.
What this unit covers
- Basic structure of C program
- Compilation and execution process
- Comments and escape sequences
- Tokens and statements
- Identifiers and keywords
- Rules for naming valid identifiers
Rules for naming valid identifiers
What is an Identifier and Keyword? Explain the rules for naming valid Identifiers in C with example.Write a program to convert a given string to lowercase without using any library functions.[5+5]
An identifier is a name given to various program elements such as variables, functions, arrays, structures, and user-defined types. Identifiers are used to uniquely identify a program element within its scope. Example: --- A keyword is a reserved word that ...
Full solved answer →Basic structure of C program
What is the basic structure of a C program? Explain each part. [5]
--- A C program is organized into several distinct sections. Below is the general template: --- - Contains comments about the program such as program name, author, date, and purpose. - Written using / ... / (multi-line) or // (single-line). - Ignored by the...
Full solved answer →What is the basic structure of a C program? Explain each part. [5]
--- A C program is organized into several distinct sections. Below is the general template: --- - Contains comments about the program such as program name, author, date, and purpose. - Written using / ... / (multi-line) or // (single-line). - Ignored by the...
Full solved answer →Define the basic structure of C program. Explain the Compilation and Execution of a C program? [5]
--- A C program is organized into several distinct sections. The basic structure is as follows: Section Description ------ Documentation Comments describing the program Link / Header include directives to include library files Definition define for symbolic...
Full solved answer →Comments and escape sequences
Write Short Notes on: a) Escape Sequence Write Short Notes on: b) Null Pointer [2.5+2.5]
--- An escape sequence is a combination of characters that begins with a backslash (\) followed by one or more characters. It is used to represent certain special, non-printable, or reserved characters within a string or character literal in C (and other pr...
Full solved answer →What are the uses of comments and escape sequences in a C program, explain with example? [5]
--- Comments are non-executable statements used to explain and document the code. The compiler ignores comments completely during compilation. - To explain the purpose of code for better readability - To document functions, variables, and logic - To tempora...
Full solved answer →Identifiers and keywords
What is an Identifier and keyword? Explain the rules for naming valid identifiers in C with example.Write a C program to find sum of digits of a 'n' digit number.[5+5]
An identifier is a name given to various program elements such as variables, functions, arrays, structures, and other user-defined items. Identifiers are used to uniquely identify a program element during execution. Example: --- A keyword is a reserved word...
Full solved answer →Compilation and execution process
Find errors (If any) in the following program and rewrite it.
#define (studio,h)
float main < >
int m [ ] [ ] = 1,2,3,4;
for (i = 4, I>=0 ; i--)
for (j=0, j <4; j++);
m[i] [j] = a[i][j] + b[i][j];
return 0. 0;
}
[5]
--- Erroneous Code Error Description ------------------------------------- 1 define (studio,h) Wrong preprocessor directive; should be include <stdio.h 2 float main < main must return int, not float; < should be () 3 int m[][] 2D array declaration is incomp...
Full solved answer →Tokens and statements
Define token. Describe any three types of statements. [5]
A token is the smallest meaningful unit in a programming language that the lexical analyzer (scanner) recognizes during the compilation process. Tokens are the basic building blocks of a program, produced by breaking the source code into categorized lexical...
Full solved answer →Make Unit 1 stick
Practice BIT102 with flashcards & quizzes