Programming in C Question Bank PDF
Document Details
Uploaded by Deleted User
ARKA JAIN University
Rajesh Kumar Gupta
Tags
Related
- BSc Part 1 Computer Science 2022 Past Paper (PDF) - F-3618
- Programming for Problem Solving-II Test 2 Exam - October 2019 PDF
- C Programming Exam Questions PDF 2024-25
- Structured Programming - C# Questions Bank PDF
- Quiz #1 (Up to Lecture 04, Chap 4) - Programming Quiz - eClass PDF
- Programming in C Practical Viva Questions PDF
Summary
This document is a question bank for a programming in C course, likely for an undergraduate level semester. Topics covered include introductory computer concepts, algorithms, data types, and structures in a C programming context.
Full Transcript
+-----------------------------------+-----------------------------------+ | **Sl.** | **Questions** | | | | | **No** | | +===...
+-----------------------------------+-----------------------------------+ | **Sl.** | **Questions** | | | | | **No** | | +===================================+===================================+ | 1 | What is **Computer**. Describe | | | the various types of computers | +-----------------------------------+-----------------------------------+ | 2 | What are **input devices** ? | | | Mention and explain any two input | | | devices | +-----------------------------------+-----------------------------------+ | 3 | What is **software**? Explain | | | different types of software. | +-----------------------------------+-----------------------------------+ | 4 | With a neat diagram explain the | | | basic structure of a computer | +-----------------------------------+-----------------------------------+ | 5 | What is **pseudocode**? Explain | | | with example ,how it is used as a | | | problem solving tool | +-----------------------------------+-----------------------------------+ | | Define pseudocode. Write a | | | pseudocode to find the sum and | | | average of given three numbers | +-----------------------------------+-----------------------------------+ | 6 | Define **Algorithm**. Write an | | | algorithm to find the area and | | | perimeter of a circle | +-----------------------------------+-----------------------------------+ | | What is an Algorithm? Write an | | | algorithm to find the largest of | | | 3 numbers | +-----------------------------------+-----------------------------------+ | | Compare pseudocode with an | | | algorithm | +-----------------------------------+-----------------------------------+ | 7 | Define **flowchar**t. Explain | | | with an example | +-----------------------------------+-----------------------------------+ | | Draw the flowchart and write a C | | | program to compute simple | | | interest | +-----------------------------------+-----------------------------------+ | 8 | Explain the basic **structure of | | | a C program** with an example | +-----------------------------------+-----------------------------------+ | | Explain the block structure of a | | | C program | +-----------------------------------+-----------------------------------+ | | Write the general structure of C. | | | Explain with an example | +-----------------------------------+-----------------------------------+ | 9 | What is **Token**? What are the | | | different types of token | | | available in C language | +-----------------------------------+-----------------------------------+ | 10 | Write and explain the basic | | | concepts of a C program | +-----------------------------------+-----------------------------------+ | 11 | What is an **identifier** | | | (variable)? What are the rules to | | | construct identifier(varible)? | | | Classify the following as | | | valid/invalid Identifiers. | +-----------------------------------+-----------------------------------+ | | What is **variable**? List the | | | restrictions on the variable | | | names | +-----------------------------------+-----------------------------------+ | | Define variable. Explain the | | | rules for constricting variables | | | in C language. | +-----------------------------------+-----------------------------------+ | | Define i)variable ii) Constant | | | iii) Associativity iv)Precedence | +-----------------------------------+-----------------------------------+ | 13 | Explain with example, the various | | | constants available in „C‟ | | | language | +-----------------------------------+-----------------------------------+ | 14 | List all the **operators** used | | | in C. Give examples | +-----------------------------------+-----------------------------------+ | | Explain any five operators used | | | in C language | +-----------------------------------+-----------------------------------+ | | What is an operator? List and | | | explain various types of | | | operators | +-----------------------------------+-----------------------------------+ | | Explain the following operators | | | in C language | | | | | | i\) Relational ii) Logical iii) | | | Conditional | +-----------------------------------+-----------------------------------+ | 15 | What is an assignment statement? | | | Give the general form of an | | | assignment statement | +-----------------------------------+-----------------------------------+ | 16 | What are basic **data types** | | | available in „C‟? Write the | | | significance of each data type | +-----------------------------------+-----------------------------------+ | | | +-----------------------------------+-----------------------------------+ | | | +-----------------------------------+-----------------------------------+ | | | +-----------------------------------+-----------------------------------+ | | | +-----------------------------------+-----------------------------------+ | | Write a C program that computes | | | the size of int, float, double | | | and char | +-----------------------------------+-----------------------------------+ +-----------------+-----------------+-----------------+-----------------+ | | | | | +-----------------+-----------------+-----------------+-----------------+ | | | | | +-----------------+-----------------+-----------------+-----------------+ | | | | | +-----------------+-----------------+-----------------+-----------------+ | | | | | +-----------------+-----------------+-----------------+-----------------+ | | | | | +-----------------+-----------------+-----------------+-----------------+ | | | | | +-----------------+-----------------+-----------------+-----------------+ | | | i. 100 % 20 \< | | | | | = 20 -- 5 + | | | | | 100 % 10 -- | | | | | 20 = = 5 \> | | | | | = 1 != 20 | | | | | | | | | | ii. | | +-----------------+-----------------+-----------------+-----------------+ | | | i. area= | | | | | s(s-a)(s-b) | | | | | (s-c) | | | | | | | | | | ii. | | +-----------------+-----------------+-----------------+-----------------+ | | | | | +-----------------+-----------------+-----------------+-----------------+ +-----------------------------------+-----------------------------------+ | **Sl.** | **Questions** | | | | | **No** | | +===================================+===================================+ | 1. | List all conditional control | | | statements used in C. Explain any | | | two with syntax and example | +-----------------------------------+-----------------------------------+ | 2. | Write a C program that reads from | | | the user an arithmetic operator | | | and two | | | | | | operands, perform the | | | corresponding arithmetic | | | operation on the operandsusing | | | switch statement | +-----------------------------------+-----------------------------------+ | 3. | Implement a C program to find the | | | reverse of an integer number and | | | check whether it is palindrome or | | | not | +-----------------------------------+-----------------------------------+ | 4. | What are unconditional control | | | statements? Explain any two with | | | syntax and example | +-----------------------------------+-----------------------------------+ | 5. | Write a C program to find the | | | biggest of three numbers | +-----------------------------------+-----------------------------------+ | 6. | Explain switch statement with | | | syntax and example | +-----------------------------------+-----------------------------------+ | 7. | List the differences between | | | while loop and do-while loop. | | | write a C program to find sum of | | | Natura numbers from 1 to N using | | | for loop | +-----------------------------------+-----------------------------------+ | 8. | Write a C program to find the | | | factorial of a number using | | | do-while ,where the number **n** | | | is entered by user. | +-----------------------------------+-----------------------------------+ | 9. | What is two way selection | | | statements? Explain if, if else, | | | and cascaded if-else with | | | examples. | +-----------------------------------+-----------------------------------+ | 10 | Write a C program that takes from | | | user an arithmetic operator („+‟, | | | „-„, „\*‟, or | | | | | | „/‟) and two operands. Perform | | | corresponding arithmetic | | | operation on theoperands using | | | switch statement | +-----------------------------------+-----------------------------------+ | 11 | Explain with example ,the meaning | | | of statement and block in a „C‟ | | | program | +-----------------------------------+-----------------------------------+ | 12 | Write a „C‟ program to | | | demonstrate the use of | | | unconditional goto statement | +-----------------------------------+-----------------------------------+ | 13 | Explain with syntax ,if, if-else | | | and nested if-else statements in | | | „C‟ program | +-----------------------------------+-----------------------------------+ | 14 | Explain with syntax , the | | | different loops used in „C‟ | | | program | +-----------------------------------+-----------------------------------+ | 15 | Write a program in „C‟ to find | | | the sum of „n‟ natural numbers | | | without using any loops | +-----------------------------------+-----------------------------------+ | 16 | Write a C program that takes | | | three coefficients (a,b,and c) of | | | a quadtatic equation ; (ax2+bx+c) | | | as input and compute all possible | | | roots and print them | | | | | | with appropriate messages. | +-----------------------------------+-----------------------------------+ | 17 | Show how break and continue | | | statements are used in a C | | | program, with example | +-----------------------------------+-----------------------------------+ | 18 | Explain with examples formatted | | | input output statements in C | +-----------------------------------+-----------------------------------+ | 19 | Write a C program to find GCD of | | | two numbers using ternary | | | operator and for loop | +-----------------------------------+-----------------------------------+ | 20 | Write a calculator program in C | | | language to do simple operations | | | like addition, subtraction, | | | multiplication and division. Use | | | switch statement in your | | | | | | program | +-----------------------------------+-----------------------------------+ | 21 | What is dangling else problem? | | | Explain how to handle tis in C | | | programming | +-----------------------------------+-----------------------------------+ +-----------+-----------+-----------+-----------+-----------+-----------+ | | **Sl.** | **Questio | | | | | | | ns** | | | | | | **No** | | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 1 | What is | | | | | | | **array** | | | | | | | ? Explain | | | | | | | the | | | | | | | declarati | | | | | | | on | | | | | | | and | | | | | | | initializ | | | | | | | ation | | | | | | | of one | | | | | | | dimension | | | | | | | aland | | | | | | | two | | | | | | | dimension | | | | | | | al | | | | | | | array | | | | | | | with an | | | | | | | example | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | | Define | | | | | | | array.Exp | | | | | | | lain | | | | | | | with | | | | | | | suitable | | | | | | | example | | | | | | | how to | | | | | | | declare | | | | | | | and | | | | | | | initializ | | | | | | | e | | | | | | | 1D | | | | | | | | | | | | | | array | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 2 | Write a C | | | | | | | program | | | | | | | to read N | | | | | | | integers | | | | | | | into an | | | | | | | array A | | | | | | | and to | | | | | | | find the | | | | | | | | | | | | | | (i)sum of | | | | | | | odd | | | | | | | numbers,( | | | | | | | ii) | | | | | | | sum of | | | | | | | even | | | | | | | numbers,( | | | | | | | iii) | | | | | | | average | | | | | | | of all | | | | | | | numbers.O | | | | | | | utput | | | | | | | the | | | | | | | results | | | | | | | computed | | | | | | | with | | | | | | | appropria | | | | | | | te | | | | | | | headings | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 3 | Write a C | | | | | | | program | | | | | | | to search | | | | | | | an | | | | | | | element | | | | | | | using | | | | | | | linear | | | | | | | and | | | | | | | binary | | | | | | | technique | | | | | | | s | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | | Write a C | | | | | | | program | | | | | | | for | | | | | | | \[conside | | | | | | | r | | | | | | | integer | | | | | | | data\] | | | | | | | | | | | | | | (i) | | | | | | | Bubble | | | | | | | sort (ii) | | | | | | | Linear | | | | | | | search | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | | Write a C | | | | | | | program | | | | | | | to read N | | | | | | | numbers | | | | | | | into an | | | | | | | array & | | | | | | | perform | | | | | | | Linear | | | | | | | search | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | | Write an | | | | | | | algorithm | | | | | | | and | | | | | | | develop a | | | | | | | C program | | | | | | | that | | | | | | | reads N | | | | | | | integer | | | | | | | numbers | | | | | | | and | | | | | | | | | | | | | | arrange | | | | | | | them in | | | | | | | ascending | | | | | | | order | | | | | | | using | | | | | | | selection | | | | | | | Sort | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | | Write an | | | | | | | algorithm | | | | | | | and | | | | | | | develop a | | | | | | | C program | | | | | | | to search | | | | | | | an | | | | | | | integer | | | | | | | from N | | | | | | | | | | | | | | numbers | | | | | | | in | | | | | | | ascending | | | | | | | order | | | | | | | using | | | | | | | binary | | | | | | | searching | | | | | | | technique | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 4 | Write a C | | | | | | | program | | | | | | | to find | | | | | | | the | | | | | | | transpose | | | | | | | of a | | | | | | | given | | | | | | | matrix | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 5 | Write a C | | | | | | | program | | | | | | | that | | | | | | | accepts | | | | | | | (3×3 | | | | | | | ordered | | | | | | | matrices | | | | | | | A and | | | | | | | B),and | | | | | | | compute | | | | | | | | | | | | | | the | | | | | | | following | | | | | | | (i)summat | | | | | | | ion | | | | | | | of Two | | | | | | | numbers | | | | | | | (ii) | | | | | | | Subtracti | | | | | | | on | | | | | | | of Two | | | | | | | numbers | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 6 | Write a C | | | | | | | program | | | | | | | to find | | | | | | | the sum | | | | | | | and | | | | | | | average | | | | | | | of n | | | | | | | integer | | | | | | | numbers | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 7 | Write a C | | | | | | | program | | | | | | | to find | | | | | | | the | | | | | | | largest | | | | | | | element | | | | | | | in an | | | | | | | array | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | | Write a C | | | | | | | program | | | | | | | to find | | | | | | | the | | | | | | | greatest | | | | | | | number | | | | | | | from two | | | | | | | dimension | | | | | | | al | | | | | | | array | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 8 | Write a C | | | | | | | program | | | | | | | to sort | | | | | | | the | | | | | | | elements | | | | | | | by | | | | | | | passing | | | | | | | array as | | | | | | | function | | | | | | | argument | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 9 | Define | | | | | | | **string* | | | | | | | *. | | | | | | | How | | | | | | | string is | | | | | | | declared | | | | | | | and | | | | | | | initializ | | | | | | | ed | | | | | | | ? Explain | | | | | | | stringinp | | | | | | | ut/output | | | | | | | functions | | | | | | | with an | | | | | | | example | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 10 | What is | | | | | | | string | | | | | | | **?** | | | | | | | Write a C | | | | | | | program | | | | | | | that | | | | | | | reads a | | | | | | | sentence | | | | | | | and | | | | | | | prints | | | | | | | the | | | | | | | | | | | | | | frequency | | | | | | | of each | | | | | | | of the | | | | | | | vowels | | | | | | | and total | | | | | | | count of | | | | | | | consonant | | | | | | | s? | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 11 | Write a C | | | | | | | program | | | | | | | to | | | | | | | eliminate | | | | | | | multiple | | | | | | | spaces | | | | | | | from a | | | | | | | sentence | | | | | | | and make | | | | | | | it | | | | | | | | | | | | | | single | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 12 | Explain | | | | | | | with | | | | | | | syntax | | | | | | | and | | | | | | | example | | | | | | | ,the | | | | | | | different | | | | | | | string | | | | | | | manipulat | | | | | | | ion | | | | | | | libraryfu | | | | | | | nctions | | | | | | | with | | | | | | | example | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | | Define a | | | | | | | string. | | | | | | | Explain | | | | | | | any 4 | | | | | | | string | | | | | | | library | | | | | | | functions | | | | | | | with | | | | | | | syntax | | | | | | | and | | | | | | | | | | | | | | example | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | | Explain | | | | | | | string | | | | | | | manipulat | | | | | | | ion | | | | | | | library | | | | | | | functions | | | | | | | with | | | | | | | their | | | | | | | syntaxes | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 13 | Define | | | | | | | string. | | | | | | | List out | | | | | | | all | | | | | | | string | | | | | | | manipulat | | | | | | | ion | | | | | | | function. | | | | | | | Explain | | | | | | | any two | | | | | | | with | | | | | | | | | | | | | | example | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ | | 14 | Write a C | | | | | | | Program | | | | | | | to | | | | | | | implement | | | | | | | string | | | | | | | copy | | | | | | | operation | | | | | | | STRCOPY(s | | | | | | | tr1,str2) | | | | +-----------+-----------+-----------+-----------+-----------+-----------+ +-----------------+-----------------+-----------------+-----------------+ | | | that copies | | | | | string str1 to | | | | | another string | | | | | str2 without | | | | | using library | | | | | function | | +=================+=================+=================+=================+ | | | Write a C | | | | | program to copy | | | | | a string ( | | | | | combination of | | | | | digits and | | | | | alphabet ) to | | | | | another string | | | | | (only | | | | | alphabets) | | +-----------------+-----------------+-----------------+-----------------+ | | 15 | Write a program | | | | | to replace each | | | | | constant in a | | | | | string with the | | | | | text one except | | | | | | | | | | letter „z‟ „Z‟ | | | | | and „a‟ „A‟. | | | | | Thus the string | | | | | "Programming in | | | | | C is fun" | | | | | should | | | | | bemodified as | | | | | "Qsphsannjoh jo | | | | | D jt gvo". | | +-----------------+-----------------+-----------------+-----------------+ | | 16 | Write a C | | | | | program to | | | | | concatenate two | | | | | strings without | | | | | using built-in | | | | | functionstrcat( | | | | | ) | | +-----------------+-----------------+-----------------+-----------------+ | | 17 | Explain with | | | | | example (i) | | | | | Character | | | | | string (ii) | | | | | String literal | | | | | (iii) storage | | | | | classes | | +-----------------+-----------------+-----------------+-----------------+ | | 18 | How string is | | | | | declared and | | | | | initialized? | | | | | Explain any | | | | | four string | | | | | manipulation | | | | | functions with | | | | | examples | | +-----------------+-----------------+-----------------+-----------------+ | | 19 | Write a C | | | | | program to | | | | | check whether | | | | | the given | | | | | string is | | | | | palindrome or | | | | | notwithout | | | | | using in built | | | | | function | | +-----------------+-----------------+-----------------+-----------------+ | | 20 | Write a C | | | | | program to | | | | | search a name | | | | | in a given list | | | | | using binary | | | | | search | | | | | technique | | +-----------------+-----------------+-----------------+-----------------+ | | | | | +-----------------+-----------------+-----------------+-----------------+ +-----------------------------------+-----------------------------------+ | 1 | **What is function** ? Explain | | | the difference between user | | | defined and library functions | +===================================+===================================+ | 2 | Explain the different elements of | | | user defined functions in detail | +-----------------------------------+-----------------------------------+ | | Explain function call, function | | | definition and function prototype | | | with examples | +-----------------------------------+-----------------------------------+ | 3 | What is function? Write a | | | function to find the sum of two | | | numbers | +-----------------------------------+-----------------------------------+ | 4 | Explain two categories/types of | | | argument passing techniques, with | | | examples | +-----------------------------------+-----------------------------------+ | | Differentiate between call by | | | value and call by reference with | | | examples | +-----------------------------------+-----------------------------------+ | 5 | Explain the classification of | | | user defined functions | +-----------------------------------+-----------------------------------+ | | Define a function. List and | | | explain the categories of user | | | defined functions | +-----------------------------------+-----------------------------------+ | | What is function? Explain the | | | type of functions based on | | | parameters | +-----------------------------------+-----------------------------------+ | | What is function? Explain | | | different classification of user | | | defined functions based on | | | parameter passing and return type | | | with examples | +-----------------------------------+-----------------------------------+ | 6 | Write a C function isprime(num) | | | that accepts an integer argument | | | and returns1 if the argument is a | | | prime or 0 otherwise. Write a | | | program that invokes this | | | | | | function to generate prime | | | numbers between the given ranges | +-----------------------------------+-----------------------------------+ | | Write a c-program using function | | | to check whether the given number | | | is prime or not. | +-----------------------------------+-----------------------------------+ | 7 | Write a program in „C‟ using | | | functions to swap two numbers | +-----------------------------------+-----------------------------------+ | | Write a program in C using | | | functions to swap two numbers | | | using global variables concept | | | and call by reference concept. | +-----------------------------------+-----------------------------------+ | 8 | What are actual parameters and | | | formal parameters? Illustrate | | | with example | +-----------------------------------+-----------------------------------+ | 9 | Write a C program to find the | | | factorial of a number using | | | functions | +-----------------------------------+-----------------------------------+ | 10 | Write a program to find GCD and | | | LCM of two numbers using concept | | | of functions | +-----------------------------------+-----------------------------------+ | 11 | Give the scope and life time of | | | the following | | | | | | (i)External variable (ii) Static | | | variable (iii) Automatic variable | | | (iv) Registervariable | +-----------------------------------+-----------------------------------+ | 12 | What are the three possibilities | | | of defining a user defined | | | functions in „C‟? | +-----------------------------------+-----------------------------------+ | 13 | What is **Recursion**? Write a C | | | program to compute polynomial | | | co-efficient | | | | | | **nCr** using recursion | +-----------------------------------+-----------------------------------+ | | Write a C program for evaluating | | | the binomial coefficients using a | | | function factorial(n) | +-----------------------------------+-----------------------------------+ | | Write a C program to find the | | | binomial co-efficient a number | | | using recursion | +-----------------------------------+-----------------------------------+ | 14 | Define a recursion. Write a C | | | recursive function for | | | multiplying two integers where a | | | function call is passed with two | | | integers m and n | +-----------------------------------+-----------------------------------+ | 15 | Write a C program to check a | | | number is a prime or not using | | | recursion | +-----------------------------------+-----------------------------------+ | 16 | Write a C program to find the | | | factorial of a number using | | | recursion | +-----------------------------------+-----------------------------------+ | 17 | Explain recursion. and write a | | | program to find nth term of | | | Fibonacci series | +-----------------------------------+-----------------------------------+ | | | +-----------------------------------+-----------------------------------+ Write a C program to calculate the Fibonacci sequence using recursion functions -- ---- ---------------------------------------------------------------------------------------------------------- -- Write a c-program using functions to generate the Fibonacci series. 18 What is recursion? Explain. Write a c-program using recursive function for Binary to Decimal Conversion.