This document contains information about the Introduction to C Programming course at Dhanalakshmi College of Engineering. It includes 20 multiple choice questions about C programming concepts like data types, variables, operators, input/output statements, decision making statements, and loops. Sample code is provided to demonstrate various C programming constructs like if/else statements, while loops, and functions.
A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. Functions are used to perform certain actions, and they are important for reusing code: Define the code once, and use it many times.
C Tutorial, Clanguage,
C Programming Tutorial
C - Home
C - Overview
C - Environment Setup
C - Program Structure
C - Basic Syntax
C - Data Types
C - Variables
C - Constants
C - Storage Classes
C - Operators
C - Decision Making
C - Loops
C - Functions
C - Scope Rules
C - Arrays
C - Pointers
C - Strings
C - Structures
C - Unions
C - Bit Fields
C - Typedef
C - Input & Output
C - File I/O
C - Preprocessors
C - Header Files
C - Type Casting
C - Error Handling
C - Recursion
C - Variable Arguments
C - Memory Management
C - Command Line Arguments
A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. Functions are used to perform certain actions, and they are important for reusing code: Define the code once, and use it many times.
C Tutorial, Clanguage,
C Programming Tutorial
C - Home
C - Overview
C - Environment Setup
C - Program Structure
C - Basic Syntax
C - Data Types
C - Variables
C - Constants
C - Storage Classes
C - Operators
C - Decision Making
C - Loops
C - Functions
C - Scope Rules
C - Arrays
C - Pointers
C - Strings
C - Structures
C - Unions
C - Bit Fields
C - Typedef
C - Input & Output
C - File I/O
C - Preprocessors
C - Header Files
C - Type Casting
C - Error Handling
C - Recursion
C - Variable Arguments
C - Memory Management
C - Command Line Arguments
Input refers to accepting data while output refers to presenting data. Normally the data is accepted from keyboard and is outputted onto the screen.
C language has a series of standard input-output (I/O) functions. Such I/O functions together form a library named stdio.h. Irrespective of the version of C language, user will have access to all such library functions. These library functions are classified into three broad categories.
a) Console I/O functions : Functions which accept input from keyboard and produce output on the screen.
b) Disk I/O functions : Functions which perform I/O operations on secondary storage devices like floppy disks or hard disks.
c) Port I/O functions : Functions which perform I/O operations on various ports like printer port, mouse port, etc.
Console I/
Programming Fundamentals Functions in C and typesimtiazalijoono
Programming Fundamentals
Functions in C
Lecture Outline
• Functions
• Function declaration
• Function call
• Function definition
– Passing arguments to function
1) Passing constants
2) Passing variables
– Pass by value
– Returning values from functions
• Preprocessor directives
• Local and external variables
Constructors, Destructors, call in parameterized Constructor, Multiple constructor in a class, Explicit/implicit call, Copy constructor, Dynamic Constructors and call in parameterized Constructor
Input refers to accepting data while output refers to presenting data. Normally the data is accepted from keyboard and is outputted onto the screen.
C language has a series of standard input-output (I/O) functions. Such I/O functions together form a library named stdio.h. Irrespective of the version of C language, user will have access to all such library functions. These library functions are classified into three broad categories.
a) Console I/O functions : Functions which accept input from keyboard and produce output on the screen.
b) Disk I/O functions : Functions which perform I/O operations on secondary storage devices like floppy disks or hard disks.
c) Port I/O functions : Functions which perform I/O operations on various ports like printer port, mouse port, etc.
Console I/
Programming Fundamentals Functions in C and typesimtiazalijoono
Programming Fundamentals
Functions in C
Lecture Outline
• Functions
• Function declaration
• Function call
• Function definition
– Passing arguments to function
1) Passing constants
2) Passing variables
– Pass by value
– Returning values from functions
• Preprocessor directives
• Local and external variables
Constructors, Destructors, call in parameterized Constructor, Multiple constructor in a class, Explicit/implicit call, Copy constructor, Dynamic Constructors and call in parameterized Constructor
The aptitude test consisted tricky questions on core subjects of CSE like C , C++, Java ,Data Structures, Database, Computer Networks, Theory of Computation.
Placement Papers are published here to help freshers to get themselves prepared for the tests and successfully procure jobs in top companies of India including Infosys, Wipro, TCS, HCL, HP, Accenture, CTS etc. This is the section where you can find previous and latest questions, practice them with the solutions in hand.
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
How to Split Bills in the Odoo 17 POS ModuleCeline George
Bills have a main role in point of sale procedure. It will help to track sales, handling payments and giving receipts to customers. Bill splitting also has an important role in POS. For example, If some friends come together for dinner and if they want to divide the bill then it is possible by POS bill splitting. This slide will show how to split bills in odoo 17 POS.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Ethnobotany and Ethnopharmacology:
Ethnobotany in herbal drug evaluation,
Impact of Ethnobotany in traditional medicine,
New development in herbals,
Bio-prospecting tools for drug discovery,
Role of Ethnopharmacology in drug evaluation,
Reverse Pharmacology.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
1. OCS752 − Introduction to C Programming VII Semester EEE
Dept. of CSE Dhanalakshmi College of Engineering 1
DHANALAKSHMI COLLEGE OF ENGINEERING
Tambaram, Chennai
Department of Computer Science and Engineering
OCS752 INTRODUCTION TO C PROGRAMMING
Year / Sem : IV / VII
2 Marks Q & A
2. OCS752 − Introduction to C Programming VII Semester EEE
Dept. of CSE Dhanalakshmi College of Engineering 2
UNIT – I
INTRODUCTION
Structure of C program – Basics: Data Types – Constants – Variables – Keywords – Operators –
Precedence and Associativity – Expressions – Input/Output statements – Assignment statements –
Decision making statements – Switch statement – Looping statements – Pre processor directives –
Compilation process – Exercise programs: Check whether the required amount can be withdrawn based
on the available amount – Menu-driven program to find the area of different shapes – Find the sum of
even numbers
PART – A
1. What are the different data types in C? (A/M – 14, N/D – 16)
Data types in C
1) Character
2) Integer
3) Floating point
4) Double
2. What are Keywords? (A/M – 15)
Keywords are reserved words with a predefined meaning. Keywords are part of the syntax and they
cannot be used as an identifier.
Example: int money;
Here, int is a keyword and money is a variable of type int (integer).
3. List the various input and output statements in C. (A/M – 15, N/D – 15)
Various input and output statements in C
1) Formatted input statement
2) Unformatted input statement
3) Formatted output statement
4) Unformatted output statement
4. What is a variable? Give example. (N/D – 14, A/M – 16)
Variable is a named location in memory where a program can manipulate the data. This location is used
to hold the value of a variable.
Syntax: data_type variable_name = value;
Example: int x = 50, char flag = ‘x’;
3. OCS752 − Introduction to C Programming VII Semester EEE
Dept. of CSE Dhanalakshmi College of Engineering 3
5. Distinguish between Local variable and Global variable in C.
S. No. Local variable Global variable
1 Local variables are declared inside a function.
Global variables are declared outside a
function.
2
Local variables are recreated when a function
is called.
Global variables are not recreated when a
function is called.
3
Example
main()
{
int local =10; // Local variable
printf(“Local variable = %d”,local);
}
Example
int global=5; // Global variable
main()
{
printf(“Global variable = %d”,global);
}
6. Differentiate unformatted input/output statement from formatted input/output statement.
(A/M – 19)
S. No. Unformatted input/output statement Formatted input/output statement
1 Unformatted input/output transfers the
internal binary representation of the data
directly between memory and file.
Formatted input/output converts the
internal binary representation of the data to
ASCII characters which are written to the
output file.
2
Unformatted input/output statements are
getchar(), putchar(), getch(), putch(), gets()
and puts().
Formatted input/output statements are
scanf( ), fscanf(), printf() and fprintf().
3
Example
#include<stdio.h>
void main()
{
char ch;
ch = getch();
putch(ch);
}
Example
#include<stdio.h>
void main()
{
int a;
scanf(“%d”,&a);
printf(“number=%d”,a);
}
7. What are constants in C? Mention its types. (A/M – 17)
The constants refer to fixed values whose values do not change during its execution. These fixed values
are also called literals.
4. OCS752 − Introduction to C Programming VII Semester EEE
Dept. of CSE Dhanalakshmi College of Engineering 4
Types of constant
1) Integer constant
2) Floating point constant
3) Character constant
4) String constant
Example
const int LENGTH = 10;
8. What is the use of external storage class? (A/M – 18)
External storage class is used when we have global functions or variables which are shared between two
or more files. ‘extern’ is the keyword used to implement external storage class. Extern stands for external
storage class.
Example
extern int a=10;
9. Distinguish between Break statement and Continue statement. (N/D – 19)
S. No. Break statement Continue statement
1
Break statement is used to terminate the
block and gets the control out of
the switch or loop.
Continue statement is used to get the
control to the next iteration of the loop.
2
Break can appear in both switch and loop
statements.
Continue can appear only in loop
statement.
3
Example
a=0;
while(a>3)
{
if(a==2)
break;
a++;
}
Example
a=0;
while(a>3)
{
if(a==3)
continue;
a++;
}
10. List the various types of C operators. (N/D – 19)
Various types of C operators
1) Arithmetic operators
2) Relational operators
3) Equality operators
4) Logical operators
5. OCS752 − Introduction to C Programming VII Semester EEE
Dept. of CSE Dhanalakshmi College of Engineering 5
5) Unary operators
6) Assignment operators
7) Comma operators
8) Conditional operator
9) Bitwise operators
10) Sizeof operators
11. What is preprocessor directive? (A/M – 18, A/M – 19)
Preprocessor directive is a macro processor. It is used automatically by the C compiler to transform the
program before actual compilation.
Example
#define max 10
12. Differentiate While statement from Do...While statement. (A/M–16, N/D–17)
S. No. While Do...while
1
Executes the statements within the
while block, if only the condition is
true.
Executes the statements within the while
block at least once, even the condition is
false.
2
The condition is checked at the
starting of the loop.
The condition is checked at the end of the
loop.
3 It is an entry controlled loop. It is an exit controlled loop.
13. List the rules to be followed in naming an identifier. (A/M – 16)
Rules to be followed in naming an identifier
1) First letter should be an alphabet.
2) Numbers and alphabets are permitted.
3) Mixing of lower case and upper case are allowed.
4) No special symbols are permitted except underscore ( _ ).
5) Keywords are not permitted.
14. Write any four escape sequences in C. (A/M – 13)
Escape sequences in C
1) n – new line
2) t – tab
3) a – alert
4) 0 – null
6. OCS752 − Introduction to C Programming VII Semester EEE
Dept. of CSE Dhanalakshmi College of Engineering 6
15. Write a C program to find the sum of even numbers.
#include<stdio.h>
void main()
{
int i, n, sum;
sum = 0;
printf("Enter the Number : ");
scanf("%d",&n);
for(i=1; i<=n; i++)
{
if(i%2==0)
sum=sum+i;
}
printf("Sum of all Even Integers is %d",sum);
}
Output:
Enter the Number : 10
Sum of all Even Integers is 30
16. Mention the various decision making statements in C.
Various decision making statements in C
1) if statement
2) if...else statement
3) nested if statement
4) switch statement
5) nested switch statement
17. Write a note on main() in C.
Every c program must have only one main() function. The program execution starts from main()
function. The empty parenthesis () indicates that the main has no arguments.
18. What is the use of sizeof() operator in C? (N/D – 17)
The sizeof() operator is used to find the amount of memory allocated to a variable. Memory size differs
based on the data type.
Example:
sizeof(char); // it returns1
sizeof(int); // it returns 4
sizeof(float); // it returns 4
sizeof(double); // it returns 8
7. OCS752 − Introduction to C Programming VII Semester EEE
Dept. of CSE Dhanalakshmi College of Engineering 7
19. Define – Compilation
Compilation is defined as the processing of source code files to create an object file. The compiler
produces machine language instructions that correspond to the compiled source code file.
20. List the various input and output statements in C. (A/M – 15)
Various input and output statements in C
1) gets()
2) getch()
3) getchar()
4) scanf()
5) puts()
6) putch()
7) putchar()
8) printf()