Programming for Problem Solving - B.Tech 1st Semester Examination, 2024

2024Semester 3Civil-CAEnd Semester
Bihar Engineering University, Patna
B.Tech 1st Semester Examination, 2024

Programming for Problem Solving

Time: 03 Hours Code: 100111 Full Marks: 70

Instructions:

  1. The marks are indicated in the right-hand margin.
  2. There are NINE questions in this paper.
  3. Attempt FIVE questions in all.
  4. Question No. 1 is compulsory.
Q.1 Choose the correct answer the following (Any seven question only): [14]
  1. Which of the following is a valid variable name in C?

    1. 2value
    2. @value
    3. value_2
    4. value#2
  2. Which of these is not a valid data type in C?

    1. int
    2. real
    3. float
    4. char
  3. Which of the following is the correct syntax for if statement?

    1. if [condition] then
    2. if condition then
    3. if (condition)
    4. if {condition}
  4. What is the output of printf("%d", 5 + 3 * 2)?

    1. 16
    2. 11
    3. 10
    4. 13
  5. Which header file is required to use printf()?

    1. stdlib.h
    2. conio.h
    3. stdio.h
    4. string.h
  6. Which keyword is used to define a constant in C?

    1. final
    2. constant
    3. #define
    4. static
  7. What is the index of the first element in an array?

    1. 1
    2. -1
    3. 0
    4. Depends on array
  8. Which one is the logical AND operator in C?

    1. &
    2. |
    3. &&
    4. ||
  9. Which format specifier is used for printing float values?

    1. %d
    2. %c
    3. %f
    4. %x
  10. Which of these is not a loop in C?

    1. for
    2. while
    3. do-while
    4. repeat-until
Q.2 Solve both questions : [7+7=14]
  1. Explain the structure of a C program with an example.

  2. Describe basic data types in C with memory size.

Q.3 Solve both questions : [7+7=14]
  1. What is an algorithm. Write an algorithm to perform the addition of two numbers in C and draw a flowchart to represent the addition of two numbers.

  2. Write a program to check whether a number is even or odd using if-else.

Q.4 Solve both questions : [7+7=14]
  1. Explain Arithmetic and Logical operators in C with example programs.

  2. Explain Relational and Bitwise operators with example programs.

Q.5 Solve both questions : [7+7=14]
  1. Explain call by value and call by reference with examples.

  2. What is the difference between library functions and user-defined functions?

Q.6 Solve both questions : [7+7=14]
  1. What is an array in C programming? Write advantages of using arrays. Explain a one-dimensional array with a suitable example program.

  2. Describe the difference between character array and string.

Q.7 Solve both questions : [7+7=14]
  1. Write the difference Between Array and Structure in C programming.

  2. Write the difference Between Structure and Union in C programming.

Q.8 Solve both questions : [7+7=14]
  1. What is a pointer? Explain pointer declaration and initialization with sample program.

  2. What is file? Explain text file and binary file in details.

Q.9 Write short notes on any two of the following: [7x2=14]
    • Structure
    • Union
    • Recursion
    • Fibonacci series program