Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
23 views
6 Introduction To C Programming
Uploaded by
Nanda Thakare
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save 6 Introduction to C Programming For Later
Download
Save
Save 6 Introduction to C Programming For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
23 views
6 Introduction To C Programming
Uploaded by
Nanda Thakare
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save 6 Introduction to C Programming For Later
Carousel Previous
Carousel Next
Save
Save 6 Introduction to C Programming For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 9
Search
Fullscreen
“EXERCISES” Q.1. Fill in the blanks : (1) C is a High level language. (2) A€ program must be compile before it can be executed. (3) Anamed area in memory that stores a character or numeric value is © called Variable. (4) In C, a number containing a decimal point of type float. 2 (5) The memory size of a floating 2 point number is usually 4 bytes. (6) The equality checking operator in > Cis. 2 (7) *%C” is the standard function to read a single character from keyboard. 2 Q.2. State whether the following statements are true or false. (1) Cis a interpreted language. Ans : False (2) In C, an user must define the 2 meaning of keyword used.(3) The type of variable determines what kind of values it may take on. Ans : True (4) A variable name can be begin with underscore, Ans : False (5) A variable declaration tells the name and type ofa variable. Ans : False (6) “34.5” is a numeric constant, Ans; False (7) The keyword int is used to declare © a constant. Ans : False (8) The expression 4+5*6 will evaluate to 54. Ans : False (9) The expression 4 * 2 to find the square of 4 is valid in C, Ans : False (10) The standard C functions are grouped into header files. Ans : True (11) The standard C function tofind the absolute value of anumber x ¢ is abs(x). Ans : False (12) The format specifier for an integer in a printf statement in Cis \n, & Ans : False (13) Explanatory comments in C are given with the REM keyword. Ans : False Q.3. Give the purpose of each of the following in a C program, (1) float: float is a data type to store a © floating point number. E. 14 (2) char : char is a data type to store \4 a character. E.g. : ‘a” 2 (3) getchar() ; The function input a simple character from the keyboard. (4) scanf : The function performs formatted input. E.g. scanf(“%d”, & a); 3 (5) stdio.h : stdio.h is a header file which predefined standard input and $ output function. 2 (6) math.h : math.h is a header file which predefined mathematical function(7) \t = It is am escape sequence which is used in print. Q.4, Answer the following questions in e one or two sentences each : (1) What are the primary data types in$ G2. Ans : int (integer), char (Character), float (floating point number) and c double are the primary data type in C. © (2) What is a numeric constant? Ans : Numeric constant is a number. E.g. 2,3.142. > (3) What does the modulus operator do inc. Ans : Modulus operator returns the mode of a division. E.g. 4 % 3 = 1. 2 (4) What is the deference between the operators = and ==? is a assignment operator eg. s evaluating 2 numbers to find out the big one. (5) What is a header file? Ans : Header file is a predefined function which can be used in our program.(6) State the parts of a C program? Ans : Heading, inclusion, function main() with statements and optional user defined functions. (7) What is the purpose of the inclusion statements in a C program?? ¢ Ans : To include predefined user function to user program. Q.5. Write the C expression for. (1) raising 2 to the power 5: pow(2,5)s © (2) a= 7b +1 : pow(a,3)- (7*b)+1 (3) (5(f-32))/9 : (5 * (-32)/9 Q.6. Identify the valid variable name’ in C: m, N, 7N,-avg, Yod. 3 Ans: m,N. Q.7. The following statement block in C is supposed to calculate (at+b)’, but there are errors. Find out the errors and rewrite the statement block. int a ==5, b=6,ans ans=(at+b)*3; printf(The answer is, ans); 2 Ans : int a=5,b=6,ans; ans=(a+b) * 3; > printf(“The answer is %d “, ans); ==>Q.8. Answer the following in brief : (1) State the limitations of naming the variable in C. Ans : (i) Every variable name must start with a letter 0 an underscore. (ii) C recognizes upper and lowercase characters as being different. (iii) You cannot use nay of C's keywords (the words such as main, while, switch, ete. which are part of the syntax of the language) as variable © names, (2) Write short note on relational operators. Ans : These operators are used to make comparison and control the > flow of logic in a program using the if 2 and switch statements. 2 (3) Write short note on program > structure in C. Ans ; The program starts with a series 3 of comments indicating its purpose, as well as its author. This is called 3 heading, It is considered good programming style to identify and 3 document your work. Explanatory 3 comments can be written anywhere in the code ; all characters between /* 2 and */ are ignored by the compiler and 2 can be used to make the code easier to understand,Q.9. Write C programs for the following : (1) Input a value for the radius of a circle and display the area of the circle. Ans: #include
main() { float areayr; float PI=3.14; printf("enter radius\n"); seanf("%f",&r); area=PI*r*rz printf("area of circle is %f",area); 2 (2) Input the value for the side of a 2 square and display its perimeter and 5 #include
2 #include
2 int main(){ float side, area; printf(""Enter length of side of 2 square\n"); scanf("%f", &side); /* Area of Square = Side X Side */ area = pow(side, 2); printf("Area of square : %0.4f\n", > area);perimeter = 4*side: printf("Perimeter of Square : %0.4f\n", perimeter); getch(); return 0; (3) Input two numbers and display the square of their sum. Ans: #include
#include
int main() { int num1, num2, sqrl, sqr2, sum; printf("Enter any two numbe ds seanf("%d%d", &num1, &num2); sqrl = num1*num1; sqr2 = num2*num2; sum = sqrl + sqr2; printf("Sum of their square = %d", sum); getch(); return 0; } Q.10. Write C programs for the following problems from your mathematics textbook : (1) The radius of the base of a cone is § cm and its slant height is 13 cm. Find. the volume of the cone.Ans: #include
int main() { const float PI = 3.14; float r, h, volume; r=5; h=13; volume =(PI* r*r* h)/3.0; printf("Volume of Cone is %f\n", volume)3} (2) The base area of a cone is 10.5. square units and its slant height is 10 cm, What is the curved surface area of $ the cone? Ans: #include
#include
#define PI 3.14159 int main(){ float radius, height, surfaceArea; radius = 10.5; height = 10; surfaceArea = PI*radius*(radius + sqrt(height*height + radius*radius)); printf("Total surface area of Cone ; %0.4f\n", surfaceArea); return 0; —————————
You might also like
C++ Unit 1-Qb With Ans
PDF
No ratings yet
C++ Unit 1-Qb With Ans
22 pages
Overall C Question Bank For Students
PDF
No ratings yet
Overall C Question Bank For Students
42 pages
Solutions of Homework 1
PDF
100% (1)
Solutions of Homework 1
9 pages
CTSD Assignment
PDF
No ratings yet
CTSD Assignment
11 pages
C Language Codes
PDF
No ratings yet
C Language Codes
12 pages
C ques bank[1] and solutions
PDF
No ratings yet
C ques bank[1] and solutions
10 pages
pyq_c(2023)
PDF
No ratings yet
pyq_c(2023)
3 pages
PST-II-QB-28.8.23(1-5 units)
PDF
No ratings yet
PST-II-QB-28.8.23(1-5 units)
20 pages
Intra
PDF
No ratings yet
Intra
40 pages
Final Lab Report
PDF
No ratings yet
Final Lab Report
184 pages
Question bank-Module1 2
PDF
No ratings yet
Question bank-Module1 2
4 pages
CHAPTER-4.1 C FUNDAMENTALS:Programming, High Level Languages, Compiling Programs, Integrated Development Environment (Ide)
PDF
No ratings yet
CHAPTER-4.1 C FUNDAMENTALS:Programming, High Level Languages, Compiling Programs, Integrated Development Environment (Ide)
28 pages
Technical Answers
PDF
No ratings yet
Technical Answers
19 pages
(2 Hours) (Total Marks: 75: Interpretation, Depending On How It Is Carried Out
PDF
No ratings yet
(2 Hours) (Total Marks: 75: Interpretation, Depending On How It Is Carried Out
18 pages
II Sem Bcom Programming With c c Internal i (2)
PDF
No ratings yet
II Sem Bcom Programming With c c Internal i (2)
7 pages
C Language and DS Main
PDF
No ratings yet
C Language and DS Main
62 pages
2018-2019 Cse
PDF
No ratings yet
2018-2019 Cse
12 pages
Tejaswita
PDF
No ratings yet
Tejaswita
2 pages
The C Language Terminator Is (A) Semicolon (B) Colon (C) Period (D) Exclamation Mark
PDF
0% (1)
The C Language Terminator Is (A) Semicolon (B) Colon (C) Period (D) Exclamation Mark
15 pages
C Questions
PDF
No ratings yet
C Questions
12 pages
fpl
PDF
No ratings yet
fpl
8 pages
Multiple Choice Questions C Language
PDF
100% (1)
Multiple Choice Questions C Language
7 pages
Sol-Model Answer-VTU Exam-Aug 2022
PDF
100% (1)
Sol-Model Answer-VTU Exam-Aug 2022
27 pages
Rdinaz PDF
PDF
No ratings yet
Rdinaz PDF
18 pages
This Test Consists of 50 Questions - The Set Code For This Paper Is D
PDF
No ratings yet
This Test Consists of 50 Questions - The Set Code For This Paper Is D
11 pages
Sample Question.docx
PDF
No ratings yet
Sample Question.docx
10 pages
Scan C Programing Questions and Solutions
PDF
No ratings yet
Scan C Programing Questions and Solutions
27 pages
C Ojective Questions
PDF
No ratings yet
C Ojective Questions
19 pages
Prev Year Questions
PDF
No ratings yet
Prev Year Questions
9 pages
Computer Programming in C (2022)
PDF
No ratings yet
Computer Programming in C (2022)
3 pages
Unit2-2marks
PDF
No ratings yet
Unit2-2marks
9 pages
TCS Doc-3-1
PDF
No ratings yet
TCS Doc-3-1
14 pages
PracticeQuestions ESC101 Summer
PDF
No ratings yet
PracticeQuestions ESC101 Summer
19 pages
C How to Program 7th Edition Deitel Solutions Manual instant download
PDF
100% (2)
C How to Program 7th Edition Deitel Solutions Manual instant download
51 pages
Soln DC05
PDF
No ratings yet
Soln DC05
158 pages
C Solutions
PDF
No ratings yet
C Solutions
158 pages
C Programming
PDF
No ratings yet
C Programming
82 pages
C Programming
PDF
No ratings yet
C Programming
47 pages
Important Questions for Board Exam
PDF
No ratings yet
Important Questions for Board Exam
11 pages
C Questions
PDF
No ratings yet
C Questions
12 pages
Cantilever Labs
PDF
No ratings yet
Cantilever Labs
1 page
Technical C Class
PDF
No ratings yet
Technical C Class
118 pages
Section A: Is Compulsory, and Attempt Any Other Two Questions From Section B: 2. Do Not Write Anything On This Question Paper
PDF
No ratings yet
Section A: Is Compulsory, and Attempt Any Other Two Questions From Section B: 2. Do Not Write Anything On This Question Paper
5 pages
TCS Coding Programming Questions Details
PDF
100% (2)
TCS Coding Programming Questions Details
13 pages
Hemesh Kumar Chhipa - A3 PPL
PDF
No ratings yet
Hemesh Kumar Chhipa - A3 PPL
193 pages
C Language 2018
PDF
No ratings yet
C Language 2018
6 pages
C Programming
PDF
No ratings yet
C Programming
14 pages
R20-Ppsc-Unitwise Multiple Choice Questions
PDF
No ratings yet
R20-Ppsc-Unitwise Multiple Choice Questions
16 pages
Programming For Problem Solving Using C r19 Jan 2020-1
PDF
No ratings yet
Programming For Problem Solving Using C r19 Jan 2020-1
8 pages
MCQs
PDF
No ratings yet
MCQs
3 pages
Programming Lab1
PDF
No ratings yet
Programming Lab1
10 pages
1) What Do You Mean by Hardware and Software?: C Viva Questions
PDF
No ratings yet
1) What Do You Mean by Hardware and Software?: C Viva Questions
11 pages
MCQ CPPS
PDF
100% (1)
MCQ CPPS
12 pages
C How to Program 7th Edition Deitel Solutions Manual download
PDF
100% (2)
C How to Program 7th Edition Deitel Solutions Manual download
47 pages
UNIT Wise Question Bank CP
PDF
No ratings yet
UNIT Wise Question Bank CP
4 pages
Related titles
Click to expand Related Titles
Carousel Previous
Carousel Next
C++ Unit 1-Qb With Ans
PDF
C++ Unit 1-Qb With Ans
Overall C Question Bank For Students
PDF
Overall C Question Bank For Students
Solutions of Homework 1
PDF
Solutions of Homework 1
CTSD Assignment
PDF
CTSD Assignment
C Language Codes
PDF
C Language Codes
C ques bank[1] and solutions
PDF
C ques bank[1] and solutions
pyq_c(2023)
PDF
pyq_c(2023)
PST-II-QB-28.8.23(1-5 units)
PDF
PST-II-QB-28.8.23(1-5 units)
Intra
PDF
Intra
Final Lab Report
PDF
Final Lab Report
Question bank-Module1 2
PDF
Question bank-Module1 2
CHAPTER-4.1 C FUNDAMENTALS:Programming, High Level Languages, Compiling Programs, Integrated Development Environment (Ide)
PDF
CHAPTER-4.1 C FUNDAMENTALS:Programming, High Level Languages, Compiling Programs, Integrated Development Environment (Ide)
Technical Answers
PDF
Technical Answers
(2 Hours) (Total Marks: 75: Interpretation, Depending On How It Is Carried Out
PDF
(2 Hours) (Total Marks: 75: Interpretation, Depending On How It Is Carried Out
II Sem Bcom Programming With c c Internal i (2)
PDF
II Sem Bcom Programming With c c Internal i (2)
C Language and DS Main
PDF
C Language and DS Main
2018-2019 Cse
PDF
2018-2019 Cse
Tejaswita
PDF
Tejaswita
The C Language Terminator Is (A) Semicolon (B) Colon (C) Period (D) Exclamation Mark
PDF
The C Language Terminator Is (A) Semicolon (B) Colon (C) Period (D) Exclamation Mark
C Questions
PDF
C Questions
fpl
PDF
fpl
Multiple Choice Questions C Language
PDF
Multiple Choice Questions C Language
Sol-Model Answer-VTU Exam-Aug 2022
PDF
Sol-Model Answer-VTU Exam-Aug 2022
Rdinaz PDF
PDF
Rdinaz PDF
This Test Consists of 50 Questions - The Set Code For This Paper Is D
PDF
This Test Consists of 50 Questions - The Set Code For This Paper Is D
Sample Question.docx
PDF
Sample Question.docx
Scan C Programing Questions and Solutions
PDF
Scan C Programing Questions and Solutions
C Ojective Questions
PDF
C Ojective Questions
Prev Year Questions
PDF
Prev Year Questions
Computer Programming in C (2022)
PDF
Computer Programming in C (2022)
Unit2-2marks
PDF
Unit2-2marks
TCS Doc-3-1
PDF
TCS Doc-3-1
PracticeQuestions ESC101 Summer
PDF
PracticeQuestions ESC101 Summer
C How to Program 7th Edition Deitel Solutions Manual instant download
PDF
C How to Program 7th Edition Deitel Solutions Manual instant download
Soln DC05
PDF
Soln DC05
C Solutions
PDF
C Solutions
C Programming
PDF
C Programming
C Programming
PDF
C Programming
Important Questions for Board Exam
PDF
Important Questions for Board Exam
C Questions
PDF
C Questions
Cantilever Labs
PDF
Cantilever Labs
Technical C Class
PDF
Technical C Class
Section A: Is Compulsory, and Attempt Any Other Two Questions From Section B: 2. Do Not Write Anything On This Question Paper
PDF
Section A: Is Compulsory, and Attempt Any Other Two Questions From Section B: 2. Do Not Write Anything On This Question Paper
TCS Coding Programming Questions Details
PDF
TCS Coding Programming Questions Details
Hemesh Kumar Chhipa - A3 PPL
PDF
Hemesh Kumar Chhipa - A3 PPL
C Language 2018
PDF
C Language 2018
C Programming
PDF
C Programming
R20-Ppsc-Unitwise Multiple Choice Questions
PDF
R20-Ppsc-Unitwise Multiple Choice Questions
Programming For Problem Solving Using C r19 Jan 2020-1
PDF
Programming For Problem Solving Using C r19 Jan 2020-1
MCQs
PDF
MCQs
Programming Lab1
PDF
Programming Lab1
1) What Do You Mean by Hardware and Software?: C Viva Questions
PDF
1) What Do You Mean by Hardware and Software?: C Viva Questions
MCQ CPPS
PDF
MCQ CPPS
C How to Program 7th Edition Deitel Solutions Manual download
PDF
C How to Program 7th Edition Deitel Solutions Manual download
UNIT Wise Question Bank CP
PDF
UNIT Wise Question Bank CP