Skip to content
← Electronics

Electronics · 2nd Puc Science

Ch 12C Programming — 2nd PUC Electronics, concept-first.

C is one of the most widely used programming languages in the world, and it is the language every Karnataka 2nd PUC Electronics student meets first when learning to make a computer do useful work.

Exam weightage:1m × 15m × 1

154

Q&A

20

Concepts

6m

Exam weightage

Start learning — read this chapter →

Key concepts

Hover a concept to preview it and jump to its most relevant Q&A.

Chapter contents

The NCERT structure, section by section. Open a section to see its questions, then read the concept-first solution.

Introduction

C is one of the most widely used programming languages in the world, and it is the language every Karnataka 2nd PUC Electronics student meets first when learning to make a computer do useful work.

12.1

Introduction to C — program structure, tokens, data types, operators and I/O

C is a powerful, flexible and portable programming language with an elegantly structured design. Because it combines the convenience of a high-level language with elements of low-level assembly progra…

12.2

Selective Control Statements

By default a C program runs its statements one after another, from top to bottom. This straight-line flow is called sequential execution.

12.2b

Loops, Functions and Flowcharts

A loop repeats a group of statements again and again until a specified condition is satisfied; this is also called repetitive or iterative execution.

Chapter Summary

This part of the C Programming chapter covers how a program controls the order in which its statements run, and the tools it uses to make decisions, repeat work, organise code and picture logic.

More questions

154 Q
+Show 38 questions38 questions
  1. Example 1Explain the basic structure of a C program. The textbook views a C program as a group of building blocks called functions and presents the g…Free
  2. Example 2The textbook explains that a simple macro is used to define a constant. It gives the general form `#define identifier string` and the follow…Free
  3. Example 3The textbook explains the #include directive, which can take the form `#include "file name"` (a library file, with double quotation marks) o…Free
  4. Example 4The textbook states that C is a free-form language, so statements can be grouped, and shows the following 'hello C' program together with it…Preview
  5. Example 5The textbook gives the following examples of declaration of variables: ```c int length; float area; char ch; double density; int x, y, z; fl…Preview
  6. Example 6The textbook illustrates assigning values to variables within the declaration section (initialization), where the declaration consists of a…Preview
  7. Example 7The textbook illustrates assignment within an executable part, which does not include the data type: ```c x = 10; sum = 300.00; name = "Gana…Preview
  8. Example 8The program shows the use of integer arithmetic to convert a given number of days into months and days. Program ```c main() { int months, da…Preview
  9. Example 91) Write a C program to check whether given two integers are equal. ```c #include<stdio.h> void main() { int x=4, y=4; if(x==y) printf("x an…Preview
  10. Example 102) Write a C program to compare two values. ```c #include<stdio.h> void main() { float m=3.234, n=0.0546; if(m>n) printf("m is greater than…Preview
  11. Example 11Write a C program to illustrate the logical ANDing and ORing operations. ```c #include<stdio.h> void main() { int a, b, c; a=5, b=4; c=a&&b;…Preview
  12. Example 12Write a C program to illustrate the compact representation of arithmetic operations. ```c #include<stdio.h> void main() { int x=2, y=4, z=1;…Preview
  13. Example 13Write a C program to illustrate the conditional operator. ```c #include<stdio.h> void main() { int a=4, b=5, result1, result2; result1 = a>b…Preview
  14. Example 14Write a C program to illustrate the use of an increment operator. ```c #include<stdio.h> void main() { int a=6, b=8; printf("a=%d\h",a++); p…Preview
  15. Example 15Write a C program to illustrate the use of decrement operator. ```c #include<stdio.h> void main() { int a=7, b=5; printf("a=%d\h",--a); prin…Preview
  16. Example 16Write a C program using the sizeof operator to find the size of the basic data types. ```c #include<stdio.h> void main() { int a; float b; d…Preview
  17. Example 17Write a C program to accept four numbers and compute their sum and average. The textbook presents this worked program, transcribed exactly a…Preview
  18. Example 18Write a C program to accept the temperature in Fahrenheit and covert it into Celsius. (Formula : C = (f-32.0)/1.8) The textbook presents thi…Preview
  19. Example 19Write a C program to accept the radius of a circle and compute the area and its perimeter. The textbook presents this worked program, transc…Preview
  20. Example 20Write a C program to accept a number and print it if it is an even number. The textbook presents this worked program, transcribed exactly as…Preview
  21. Example 21Write a C program to accept two floating point numbers and complete their ratio. If the ratio is greater than zero then it should exchange t…Preview
  22. Example 22Write a C program to accept two numbers and check whether they are equal or unequal. The textbook presents this worked program, transcribed…Preview
  23. Example 23Write a C program to accept a character from the keyboard and print "Yes" if it is equal to y. The textbook presents this worked program, tr…Preview
  24. Example 24Write a C program to accept the three integers and print the largest amongst them. The textbook presents this worked program, transcribed ex…Preview
  25. Example 25Write a C program to accept the height of a person and determine whether he is a dwarf, average man, taller or if he possess an abnormal hei…Preview
  26. Example 26Write a C program to illustrate the switch statement for computing the area of different geometrical figures such as a circle, a square, a t…Preview
  27. Example 27Write a C program to accept a letter for the grade obtained by the student and display the corresponding remark. The letter grade and the co…Preview
  28. Example 28Write a C program to accept your name and print it for a specified number of times. The textbook presents this worked program, transcribed e…Preview
  29. Example 29Write a C program to find the sum of the first n integers. The textbook presents this worked program, transcribed exactly as printed (includ…Preview
  30. Example 30Write a C program to print the sum of all odd integers between 1 and 40. The textbook presents this worked program, transcribed exactly as p…Preview
  31. Example 31Write a C program to accept the colour code for the colours of the rainbow and display its name. The program should be repeatedly executed a…Preview
  32. Example 32Write a C program to print the sum of the first 60 natural numbers. The textbook presents this worked program, transcribed exactly as printe…Preview
  33. Example 33Write a C program to accept the sex code of a person and display whether the person is a male or a female. The textbook presents this worked…Preview
  34. Example 34Write a C program to illustrate the use of the continue statement in a for loop. The textbook presents this worked program, transcribed exac…Preview
  35. Example 35Give a sample C program that prints the message "Welcome to PUC" (illustrating the basic structure of a C program with a standard library fu…Preview
  36. Example 36Write a C program to find the roots of the quadratic equation ax^2 + bx + c = 0 using the switch-case statement. The textbook presents this…Preview
  37. Example 37Write a C program to find the root of the given quadratic equation using the switch-case statement. The textbook presents this worked progra…Preview
  38. Example 38Write a C program to find the root of the given quadratic equation using the conditional (if-else) case. The textbook presents this worked p…Preview
+Show 3 questions3 questions
  1. Q1Write a C program to find area of a triangle when its three sides are given.Free
  2. Q2Write a C program to find the surface area and the volume of a cube.Preview
  3. Q3Write a C program to find the value of y in the following equation. y = 3x^2 + 4x - 2Preview
+Show 32 questions32 questions
  1. Q1What is C Programming language?Free
  2. Q2Why is C language suitable for both systems and applications programming?Free
  3. Q3What is function?Free
  4. Q4What is C processor?Preview
  5. Q5What is debugging a C program?Preview
  6. Q6What is a syntax error?Preview
  7. Q7What is a logical error?Preview
  8. Q8What is a runtime error?Preview
  9. Q9What is testing a program?Preview
  10. Q10Where does the program be executed in a computer?Preview
  11. Q11What are C tokens?Preview
  12. Q12What are constants?Preview
  13. Q13Write the syntax for assigning values to variables.Preview
  14. Q14Write the range of values for a keyword int.Preview
  15. Q15What is the ASCII value of a character constant “=”?Preview
  16. Q16What is a statement?Preview
  17. Q17Write Arithmetic operator used to represent remainder obtained in integer division.Preview
  18. Q18What is an operator?Preview
  19. Q19What is the value of 17%-2?Preview
  20. Q20What is a relation operator?Preview
  21. Q21What is the meaning of the symbol ‘~’?Preview
  22. Q22Write the symbol of exclusive -OR operation.Preview
  23. Q23If A =1 and B = 0, what is the value of A^B?Preview
  24. Q24What is the difference between ‘=’ and ‘==’?Preview
  25. Q25What is description of the following operator ‘^=’?Preview
  26. Q26Where is conditional operator used?Preview
  27. Q27How do you represent increment operator?Preview
  28. Q28What the following sign ‘--’ represents?Preview
  29. Q29How will be the number x = 998.286 displayed on the monitor?Preview
  30. Q30Write the syntax for continue statement.Preview
  31. Q31What is C function?Preview
  32. Q32What is the use of a function conio.h?Preview
+Show 36 questions36 questions
  1. Q1Write the commonly used directive.Free
  2. Q2What does #inlcude directive specifies?Free
  3. Q3Briefly explain #define deirective.Free
  4. Q4Briefly explain #include deirective.Preview
  5. Q5Write the steps involved in executing C program.Preview
  6. Q6What are the different types of errors a programmer do?Preview
  7. Q7Briefly explain syntax error.Preview
  8. Q8Briefly explain logical error.Preview
  9. Q9Briefly explain runtime error.Preview
  10. Q10Mention the steps involved in running the program.Preview
  11. Q11For what purpose character sets are used?Preview
  12. Q12Write any four character sers of C.Preview
  13. Q13Mention the different C tokens.Preview
  14. Q14What is a floating constant? Give an example.Preview
  15. Q15What is a character constant? Give an example.Preview
  16. Q16What is a string constant? Give an example.Preview
  17. Q17What are variables? Give an example.Preview
  18. Q18Give an example for each valid variable and invalid variable.Preview
  19. Q19What is a string constant? Give an example.Preview
  20. Q20Waht are back slash constants?Preview
  21. Q21Write the C equivalent expression for (2x+1)(3y+2z).Preview
  22. Q22Write any four arithmetic operater and its meaning.Preview
  23. Q23What is the meaning of a%b? Find the value of 21%4.Preview
  24. Q24What is the use of logical operator?Preview
  25. Q25If a=3, b=5 and c=6, find a&&b||c||(!b)&&(!c).Preview
  26. Q26What is data type conversion? Explain.Preview
  27. Q27Write the general fomat of ‘scanf()’ formated input.Preview
  28. Q28What should be the statement for an output displayed as 5 . 8 6 2 8 e - 0 3 ? Write its value.Preview
  29. Q29Mention different conditional control statement.Preview
  30. Q30For what purpose if -statement and if-else statements are used?Preview
  31. Q31Write the syntax of if- statement.Preview
  32. Q32Write the syntax of if- else statement.Preview
  33. Q33Write the syntax of do while statement.Preview
  34. Q34Write the syntax of for-statement.Preview
  35. Q35What is the use of break statement? Write it syntax.Preview
  36. Q36What are the rules used while writing subscripts?Preview
+Show 29 questions29 questions
  1. Q1Mention different sections appear in C programming.Free
  2. Q2Write the format of simple C program.Free
  3. Q3Briefly explain how to write C program.Free
  4. Q4Mention the different types of runtime erros.Preview
  5. Q5Write the different constants used in C program.Preview
  6. Q6Name any six operations.Preview
  7. Q7Mention the different relation operator and their meaning.Preview
  8. Q8Write a C program to check whether given two integers are equal.Preview
  9. Q9Write a C program to compare two values.Preview
  10. Q10How do you represent (i) logical AND (ii) logical OR (iii) logical NOT operators?Preview
  11. Q11Briefly explain bitwise operator.Preview
  12. Q12For an 8-bit computer A=6 and B=7, find the (i) bitwise ANDing of A and B, (ii) bitwise ORing of A and B.Preview
  13. Q13Find the bitwise (i) compliment of A = 00001001, (ii) exclusive ORing of A=00101010 and B=10101100Preview
  14. Q14Write a C program to illustrate the compact represention of arithmetic operations.Preview
  15. Q15Write a C program to illustate the use of increment operator.Preview
  16. Q16Briefly explain operator precedence in C.Preview
  17. Q17Which are the i/p and o/p functions used in C?Preview
  18. Q18Write the formated and unformated input and output functions in C.Preview
  19. Q19Mention different character group and their meaning.Preview
  20. Q20How does the monitor display 321 for statement (i) printf(“%d”, x)? (ii) printf(“%04d”, x)?Preview
  21. Q21How does the monitor display 28.689 for a statement (i) printf(“%5.3f”, p)? (ii) printf(“%e”, y)?Preview
  22. Q22How does the number display 0.013 for a statement printf (“%5.5f”, p) and printf (“%e”, y)Preview
  23. Q23Draw a flow chart for if-else statement.Preview
  24. Q24Mention the different control statements.Preview
  25. Q25Write the flow chart for if-statement.Preview
  26. Q26Write the syntax of nested-if statement.Preview
  27. Q27Briefly explain loop (iterative) control statement.Preview
  28. Q28Draw a flowchart for while control statement.Preview
  29. Q29Write the syntax for multi dimentional arrays.Preview
+Show 16 questions16 questions
  1. Q1Write the features of C.Free
  2. Q2Write ten basic structure of C programming (overview).Free
  3. Q3Briefly explain the format of simple C program.Free
  4. Q4Draw the flow chart to show the process of compiling and running C program.Preview
  5. Q5Write the rules for forming identifier name.Preview
  6. Q6Write the rules for forming variable name.Preview
  7. Q7If a = 25 and b=6, find (i) a+b (ii) a-b (iii) a*b (iv) a/b (v) a%b (vi) -a%b (vii) a%-bPreview
  8. Q8Write a C program to convert the given number of days into months and days. Enter days as 196 days.Preview
  9. Q9Write a C program to accept three numbers and compute their sum and average. Find the sum and average of 3, 7 and 8.Preview
  10. Q10Write a C program to accept the radius of a circle and compute the area and its perimeter. Radius, r=7m.Preview
  11. Q11Write a C program to accept two floating point numbers and compute their ratio. If the ratio is greater than zero then it should exchange th…Preview
  12. Q12Write a C program to accept two numbers and check whether they are equal or unequal.Preview
  13. Q13Write a C program to accept three integers and print the largest amongst them.Preview
  14. Q14Write a C program to find the roots of a quadratic equation ax²+bx+c=0 using switch statement.Preview
  15. Q15Write a C program to print the sum of all even integers between 1 and 55Preview
  16. Q16Write a C program to print the sum of the first 89 natural numbers.Preview