QB C Programming PDF

Summary

This document contains a question bank of past papers for a C programming course. It covers various topics of C programming, including data structures, algorithms and problem-solving in C.

Full Transcript

C programming for Problem Solving[18CPS13/23] QUESTION BANK PREAPRED BY: Dr.Jyoti Metan Module 1 : Introduction to Computer Hardware & Software Sl. Questions Marks & Year No 1 What...

C programming for Problem Solving[18CPS13/23] QUESTION BANK PREAPRED BY: Dr.Jyoti Metan Module 1 : Introduction to Computer Hardware & Software Sl. Questions Marks & Year No 1 What is Computer. Describe the various types of computers 6 Marks Jan 19, Model Qp, 2 What are input devices ? Mention and explain any two input devices 6 Marks ,Model Qp 3 What is software? Explain different types of software. 4 With a neat diagram explain the basic structure of a computer What is pseudocode? Explain with example ,how it is used as a problem 6 Marks, 5 solving tool ModelQp, Jan 15, Define pseudocode. Write a pseudocode to find the sum and average of given 5 Marks, Jun 16 three numbers Define Algorithm. Write an algorithm to find the area and perimeter of a 6 Marks, Jan 17 6 circle What is an Algorithm? Write an algorithm to find the largest of 3 numbers 6 Marks, Jan 16 Compare pseudocode with an algorithm 5 Marks,Jun 16 Define flowchart. Explain with an example 5 Marks, ModelQp 7 Draw the flowchart and write a C program to compute simple interest 4 marks,Jan 17, 6 Marks Jan 19 Explain the basic structure of a C program with an example 5 marks, Jan 15,16 8 10 Marks Jan 19 Explain the block structure of a C program 8 Marks,Jan 17 Write the general structure of C. Explain with an example 6 Marks, Jan 17 9 What is Token? What are the different types of token available in C language 6 marks Jun 15, 10 Write and explain the basic concepts of a C program 8 Marks, ModelQp What is an identifier (variable)? What are the rules to construct identifier 6 Marks, Jun 16 (varible)? Classify the following as valid/invalid Identifiers. 11 i) num2 ii) $num1 iii) +add iv) a_2 v) 199_space vi) _apple vii)#12 What is variable? List the restrictions on the variable names 6 Marks, Jan 17 Define variable. Explain the rules for constricting variables in C language. 4 Marks Jan 19 Define i)variable ii) Constant iii) Associativity iv)Precedence 8 Markas, Jan 15 13 Explain with example, the various constants available in „C‟ language 5 Marks, Jan 17 List all the operators used in C. Give examples 8 Marks ,Jun 16 14 Explain any five operators used in C language 10 Marks, Jan 15 What is an operator? List and explain various types of operators 10 Marks, Jun 15 Explain the following operators in C language 6 Marks, jan 16 i) Relational ii) Logical iii) Conditional 15 What is an assignment statement? Give the general form of an assignment 5 Marks, Jan 17 statement What are basic data types available in „C‟? Write the significance of each data 6 Marks, Jan 17 16 type Write a C program that computes the size of int, float, double and char 5 marks, ModelQp variables 17 What is type conversion? Explain two types of conversion with examples 6 Marks,Jan 15 What are the formatted input and output functions. Explain with examples 6 marks, modelQp 20 Write the guidelines to use scanf() and printf() functions in C language 8 Marks, ModelQp What is the purpose of scanf() and printf() statement ? 8 marks, Model Qp 21 Write a C program in C to find the area and perimeter of a circle 4 Marks, ModelQp 22 Write a program in C to print the numbers from 4 to 9 and their squares 4 Marks, ModelQp 23 Write a C program in C to find the area and perimeter of a rectangle 6 Marks, Jan 15 24 Write a C program which takes as input p,t,r. Compute the simple interest and 6 Marks, Jan 16 display the result 25 Write a C program to find the area of triangle when we know the lengths of all 5 Marks, ModelQp three of its sides 26 Write a C program to find the largest of three numbers using ternary operator 5 marks, Jun 16 27 What is an expression? Evaluate the following expressions 4 marks, Jan 16 i) 100 % 20 < = 20 – 5 + 100 % 10 – 20 = = 5 > = 1 != 20 ii) a + = b * = C - = 5 where a=3 b=5 and c=8 28 Convert the following mathematical expression into C equivalent 4 Marks Jan 17 i) area= s(s-a)(s-b)(s-c) ii) x = -b + b2-4ac Module : II Branching & Looping Sl. Questions Marks & Year No 1. List all conditional control statements used in C. Explain any two with syntax 6 Marks, Jan 17, and example 2. Write a C program that reads from the user an arithmetic operator and two 6 Marks,Jan 17 operands, perform the corresponding arithmetic operation on the operands using switch statement 3. Implement a C program to find the reverse of an integer number and check 8 Marks,Jun 16, whether it is palindrome or not Jan 17, 4. What are unconditional control statements? Explain any two with syntax and Jan 17, example 5. Write a C program to find the biggest of three numbers 6 Marks, Jun 16 6. Explain switch statement with syntax and example 8 Marks, Jun 16 7. List the differences between while loop and do-while loop. write a C program 8 Marks, Jun 16 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 8 Marks,Jun 16 number n is entered by user. 9. What is two way selection statements? Explain if, if else, and cascaded if-else 8 Marks,Jan 16 with examples. 10. Write a C program that takes from user an arithmetic operator („+‟, „-„, „*‟, or 8 Marks Jan 16 „/‟) and two operands. Perform corresponding arithmetic operation on the operands using switch statement 11. Explain with example ,the meaning of statement and block in a „C‟ program 5 Marks, Dec 16 12. Write a „C‟ program to demonstrate the use of unconditional goto statement 6 Marks, Dec 16 13. Explain with syntax ,if, if-else and nested if-else statements in „C‟ program 9 Marks, Dec 16 14. Explain with syntax , the different loops used in „C‟ program 9 Marks, Dec 16 15. Write a program in „C‟ to find the sum of „n‟ natural numbers without using 6 Marks ,Dec 16 any loops 16. Write a C program that takes three coefficients (a,b,and c) of a quadtatic 10 Marks, Dec 14 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 4 Marks, Dec 14 example 18. Explain with examples formatted input output statements in C 6 Marks, Jun 15 19. Write a C program to find GCD of two numbers using ternary operator and for 8 Marks, Model loop QP 20. Write a calculator program in C language to do simple operations like 8 Marks, Model addition, subtraction, multiplication and division. Use switch statement in your QP program 21. What is dangling else problem? Explain how to handle tis in C programming 6 Marks, Jun 16 Module : III Array and Strings Sl. Questions Marks & Year No 1 What is array ? Explain the declaration and initialization of one dimensional 10Marks Jan 2019 and two dimensional array with an example 6 Marks,Jan-2017, Jan-2016,Model QP Define array.Explain with suitable example how to declare and initialize 1D 10 Marks Jun array 2019 2 Write a C program to read N integers into an array A and to find the 6 Marks (i)sum of odd numbers,(ii) sum of even numbers,(iii) average of all numbers. Jun 2015, Output the results computed with appropriate headings 3 Write a C program to search an element using linear and binary techniques 10 Marks Jun 2019 Write a C program for [consider integer data] 10Marks Jan 2019 (i) Bubble sort (ii) Linear search Write a C program to read N numbers into an array & perform Linear search 8M ,VTU ModelQP Write an algorithm and develop a C program that reads N integer numbers and 8M ,VTU arrange them in ascending order using selection Sort ModelQP Write an algorithm and develop a C program to search an integer from N 8M ,VTU numbers in ascending order using binary searching technique ModelQP 4 Write a C program to find the transpose of a given matrix 10Marks Jan 2019 5 Write a C program that accepts (3×3 ordered matrices A and B),and compute 8 Marks ,ModelQp the following (i)summation of Two numbers (ii) Subtraction of Two numbers 6 Write a C program to find the sum and average of n integer numbers 5 Marks,ModelQp 7 Write a C program to find the largest element in an array 6M, VTU Model Qp Write a C program to find the greatest number from two dimensional array 6 Marks ,Model Qp 8 Write a C program to sort the elements by passing array as function argument 8 Marks,Jan 2016 9 Define string. How string is declared and initialized ? Explain string 6M ,VTU input/output functions with an example ModelQP 10 What is string ? Write a C program that reads a sentence and prints the 6 Marks, frequency of each of the vowels and total count of consonants? Jan 2017 11 Write a C program to eliminate multiple spaces from a sentence and make it 10 single Marks,ModelQp 12 Explain with syntax and example ,the different string manipulation library 5 or 10 Marks, functions with example Jan 2017, ModelQp Define a string. Explain any 4 string library functions with syntax and 10 Marks Jun example 2019 Explain string manipulation library functions with their syntaxes 6M, VTU Model Qp 13 Define string. List out all string manipulation function. Explain any two with 10Marks Jan 2019 example 14 Write a C Program to implement string copy operation STRCOPY(str1,str2) 6 Mrks, that copies string str1 to another string str2 without using library function Jan 2017 Write a C program to copy a string ( combination of digits and alphabet ) to 10 Marks Jun another string (only alphabets) 2019 15 Write a program to replace each constant in a string with the text one except 6 Marks , letter „z‟ „Z‟ and „a‟ „A‟. Thus the string “Programming in C is fun” should be Jan 2016 modified as “Qsphsannjoh jo D jt gvo”. 16 Write a C program to concatenate two strings without using built-in function 8 MarksJan2016 strcat() 6M,VTU Model Qp 17 Explain with example (i) Character string (ii) String literal (iii) storage classes 6 Marks,Jan 2017 18 How string is declared and initialized? Explain any four string manipulation 8 Marks functions with examples Jun 2015 19 Write a C program to check whether the given string is palindrome or not 8M, VTU Model without using in built function Qp 20 Write a C program to search a name in a given list using binary search 10 Marks,Jun 2016 technique Module IV : Functions & Recursion 1 What is function ? Explain the difference between user defined and library 6M, VTU Model functions QP 2 Explain the different elements of user defined functions in detail 8M, VTU Model QP Explain function call, function definition and function prototype with 6 Marks, Jun 2015 examples 3 What is function? Write a function to find the sum of two numbers 6 Marks ,Jan 2015 4 Explain two categories/types of argument passing techniques, with examples 6 Marks ,Jan 2015 Differentiate between call by value and call by reference with examples 6M,VTU ModelQP 5 Explain the classification of user defined functions Define a function. List and explain the categories of user defined functions 10 Marks Jun 2019 What is function? Explain the type of functions based on parameters 10Marks Jan 2019 6 Marks,Jan 2017 What is function? Explain different classification of user defined functions 12M,VTU based on parameter passing and return type with examples ModelQP 6 Write a C function isprime(num) that accepts an integer argument and returns 8 Marks ,Jan 2015 1 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 4 M,VTU or not. ModelQP 7 Write a program in „C‟ using functions to swap two numbers 8 Marks, Jan 2017, Write a program in C using functions to swap two numbers using global 6M,VTU variables concept and call by reference concept. ModelQP 8 What are actual parameters and formal parameters? Illustrate with example 6 Marks, Jun 2015 9 Write a C program to find the factorial of a number using functions 10Marks Jan 2019 10 Write a program to find GCD and LCM of two numbers using concept of 10Marks Jan 2019 functions 11 Give the scope and life time of the following 10Marks Jan 2019 (i)External variable (ii) Static variable (iii) Automatic variable (iv) Register variable 12 What are the three possibilities of defining a user defined functions in „C‟? 6 Marks, Jan 2017 13 What is Recursion? Write a C program to compute polynomial co-efficient 4 marks,Jan 2017 nCr using recursion Write a C program for evaluating the binomial coefficients using a function 10 Marks Jun factorial(n) 2019 Write a C program to find the binomial co-efficient a number using recursion 8M,VTU ModelQP 14 Define a recursion. Write a C recursive function for multiplying two integers 10 Marks Jun where a function call is passed with two integers m and n 2019 15 Write a C program to check a number is a prime or not using recursion 5 Marks, Jan 2016 16 Write a C program to find the factorial of a number using recursion 5 Marks, Model Qp 17 Explain recursion. and write a program to find nth term of Fibonacci series 10Marks Jan 2019 6M, VTU Write a C program to calculate the Fibonacci sequence using recursion ModelQP functions Write a c-program using functions to generate the Fibonacci series. 8M, VTU ModelQP 18 What is recursion? Explain. Write a c-program using recursive function for 10M,VTU Binary to Decimal Conversion. ModelQP Module: V Structures , Pointers, Preprocessor Directives Sl. Questions Marks & Year No 1 What is structure? Explain the C syntax of structure declaration with example 5 Marks, Jan 2017, Jun 2016,ModelQp 2 Explain array of structure and structure within a structure with an example 6 marks, Jan 2017, Jun 2016, Jan 2015 3 Write a C program to maintain a record of „n‟ students details using an array of 6 marks, Jan 2017 structures with four fields(roll no,name,marks,and grade).Assume appropriate data type for each field. Print the marks of the student given the student name as input. 4 Write a C program to pass structure variable as function argument 7 marks,Jan 2016, Jan 2015 5 Write a C program to store and print name, USN, subject and IA marks of students 8 marks, Jan 2016 using structure 6 Explain the difference between array and structures 5 Marks, Jan 2017 7 Explain with example how to create a structure using „typedef‟ 5 Marks, ModelQp 8 Write a program to maintain a record of „n‟ employee detail using an array of 7 marks, Jun 2016 structures with three fields(id, name , salary) and print the details of employees whose salary is above 5000 9 What is pointer ? Explain how the pointer variable declared and initialized? 4 Marks, ModelQP, Jun 16,Jan 2017, Jun 2015 10 Explain the array of pointes with example? or Explain how pointers and arrays are 4 Marks, ModelQP, related with example Jan 2017, Jun 2016 11 What is a pointer? Write a C program to find the sum and mean of all elements in 8 marks, Jan 2016 an array using pointer 12 Write a C program to swap two numbers using call by address(pointers or 6 Marks, Jan 2016, reference) method Jun 2015 13 Write a C program using pointers to compute the Sum, Mean and Standard 6 Marks, Jan 2017, deviation of all elements stored in an array of „n‟ real numbers Jan 2015 14 What is pointer? give the advantages and disadvantages of pointer data type 8 Marks ,ModelQP 15 What is preprocessor directive? Explain #define and #include preprocessor 8 Marks, ModelQp, directives Jan 15,16, 17, Jun 15 16 Explain any five preprocessor directives in C 17 List and explain compiler control directives 18 What is a macro ?Write a macro to determine whether the given number is odd or 6 Marks,ModelQp even 19 Write a „C” program to define macros for logical operators 8 Marks,Jan 17

Use Quizgecko on...
Browser
Browser