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.
Key concepts
Hover a concept to preview it and jump to its most relevant Q&A.
Structure of a C Program
A C program is organised into standard sections - documentation, link, definition, global declaration, the main() function and sub-programs.
Most relevant Q&A
- Explain 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
- Mention different sections appear in C programming.Free
- Write the format of simple C program.Free
- Write ten basic structure of C programming (overview).Free
- Briefly explain the format of simple C program.Free
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.
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…
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.
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 questionsHide questions38 questions
- 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
- 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
- Example 3The textbook explains the #include directive, which can take the form `#include "file name"` (a library file, with double quotation marks) o…Free
- 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
- 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
- Example 6The textbook illustrates assigning values to variables within the declaration section (initialization), where the declaration consists of a…Preview
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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 questionsHide questions3 questions
+−Show 32 questionsHide questions32 questions
- Q1What is C Programming language?Free
- Q2Why is C language suitable for both systems and applications programming?Free
- Q3What is function?Free
- Q4What is C processor?Preview
- Q5What is debugging a C program?Preview
- Q6What is a syntax error?Preview
- Q7What is a logical error?Preview
- Q8What is a runtime error?Preview
- Q9What is testing a program?Preview
- Q10Where does the program be executed in a computer?Preview
- Q11What are C tokens?Preview
- Q12What are constants?Preview
- Q13Write the syntax for assigning values to variables.Preview
- Q14Write the range of values for a keyword int.Preview
- Q15What is the ASCII value of a character constant “=”?Preview
- Q16What is a statement?Preview
- Q17Write Arithmetic operator used to represent remainder obtained in integer division.Preview
- Q18What is an operator?Preview
- Q19What is the value of 17%-2?Preview
- Q20What is a relation operator?Preview
- Q21What is the meaning of the symbol ‘~’?Preview
- Q22Write the symbol of exclusive -OR operation.Preview
- Q23If A =1 and B = 0, what is the value of A^B?Preview
- Q24What is the difference between ‘=’ and ‘==’?Preview
- Q25What is description of the following operator ‘^=’?Preview
- Q26Where is conditional operator used?Preview
- Q27How do you represent increment operator?Preview
- Q28What the following sign ‘--’ represents?Preview
- Q29How will be the number x = 998.286 displayed on the monitor?Preview
- Q30Write the syntax for continue statement.Preview
- Q31What is C function?Preview
- Q32What is the use of a function conio.h?Preview
+−Show 36 questionsHide questions36 questions
- Q1Write the commonly used directive.Free
- Q2What does #inlcude directive specifies?Free
- Q3Briefly explain #define deirective.Free
- Q4Briefly explain #include deirective.Preview
- Q5Write the steps involved in executing C program.Preview
- Q6What are the different types of errors a programmer do?Preview
- Q7Briefly explain syntax error.Preview
- Q8Briefly explain logical error.Preview
- Q9Briefly explain runtime error.Preview
- Q10Mention the steps involved in running the program.Preview
- Q11For what purpose character sets are used?Preview
- Q12Write any four character sers of C.Preview
- Q13Mention the different C tokens.Preview
- Q14What is a floating constant? Give an example.Preview
- Q15What is a character constant? Give an example.Preview
- Q16What is a string constant? Give an example.Preview
- Q17What are variables? Give an example.Preview
- Q18Give an example for each valid variable and invalid variable.Preview
- Q19What is a string constant? Give an example.Preview
- Q20Waht are back slash constants?Preview
- Q21Write the C equivalent expression for (2x+1)(3y+2z).Preview
- Q22Write any four arithmetic operater and its meaning.Preview
- Q23What is the meaning of a%b? Find the value of 21%4.Preview
- Q24What is the use of logical operator?Preview
- Q25If a=3, b=5 and c=6, find a&&b||c||(!b)&&(!c).Preview
- Q26What is data type conversion? Explain.Preview
- Q27Write the general fomat of ‘scanf()’ formated input.Preview
- Q28What should be the statement for an output displayed as 5 . 8 6 2 8 e - 0 3 ? Write its value.Preview
- Q29Mention different conditional control statement.Preview
- Q30For what purpose if -statement and if-else statements are used?Preview
- Q31Write the syntax of if- statement.Preview
- Q32Write the syntax of if- else statement.Preview
- Q33Write the syntax of do while statement.Preview
- Q34Write the syntax of for-statement.Preview
- Q35What is the use of break statement? Write it syntax.Preview
- Q36What are the rules used while writing subscripts?Preview
+−Show 29 questionsHide questions29 questions
- Q1Mention different sections appear in C programming.Free
- Q2Write the format of simple C program.Free
- Q3Briefly explain how to write C program.Free
- Q4Mention the different types of runtime erros.Preview
- Q5Write the different constants used in C program.Preview
- Q6Name any six operations.Preview
- Q7Mention the different relation operator and their meaning.Preview
- Q8Write a C program to check whether given two integers are equal.Preview
- Q9Write a C program to compare two values.Preview
- Q10How do you represent (i) logical AND (ii) logical OR (iii) logical NOT operators?Preview
- Q11Briefly explain bitwise operator.Preview
- 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
- Q13Find the bitwise (i) compliment of A = 00001001, (ii) exclusive ORing of A=00101010 and B=10101100Preview
- Q14Write a C program to illustrate the compact represention of arithmetic operations.Preview
- Q15Write a C program to illustate the use of increment operator.Preview
- Q16Briefly explain operator precedence in C.Preview
- Q17Which are the i/p and o/p functions used in C?Preview
- Q18Write the formated and unformated input and output functions in C.Preview
- Q19Mention different character group and their meaning.Preview
- Q20How does the monitor display 321 for statement (i) printf(“%d”, x)? (ii) printf(“%04d”, x)?Preview
- Q21How does the monitor display 28.689 for a statement (i) printf(“%5.3f”, p)? (ii) printf(“%e”, y)?Preview
- Q22How does the number display 0.013 for a statement printf (“%5.5f”, p) and printf (“%e”, y)Preview
- Q23Draw a flow chart for if-else statement.Preview
- Q24Mention the different control statements.Preview
- Q25Write the flow chart for if-statement.Preview
- Q26Write the syntax of nested-if statement.Preview
- Q27Briefly explain loop (iterative) control statement.Preview
- Q28Draw a flowchart for while control statement.Preview
- Q29Write the syntax for multi dimentional arrays.Preview
+−Show 16 questionsHide questions16 questions
- Q1Write the features of C.Free
- Q2Write ten basic structure of C programming (overview).Free
- Q3Briefly explain the format of simple C program.Free
- Q4Draw the flow chart to show the process of compiling and running C program.Preview
- Q5Write the rules for forming identifier name.Preview
- Q6Write the rules for forming variable name.Preview
- 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
- Q8Write a C program to convert the given number of days into months and days. Enter days as 196 days.Preview
- 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
- Q10Write a C program to accept the radius of a circle and compute the area and its perimeter. Radius, r=7m.Preview
- 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
- Q12Write a C program to accept two numbers and check whether they are equal or unequal.Preview
- Q13Write a C program to accept three integers and print the largest amongst them.Preview
- Q14Write a C program to find the roots of a quadratic equation ax²+bx+c=0 using switch statement.Preview
- Q15Write a C program to print the sum of all even integers between 1 and 55Preview
- Q16Write a C program to print the sum of the first 89 natural numbers.Preview