COLLEGE OF ENGINEERING AND TECHNOLOGY, SRMIST
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
                                  CYCLE TEST – I
                       Academic Year: 2022-2023 (ODD Semester)
Program offered: B.Tech (All Branches)                               Year / Sem: I / I
Max. Marks: 25                                                       Duration: 50 minutes
         Course Code and Title: 21CSS101J: Programming for Problem Solving
Course Learning Rationale (CLR):
CLR-1: Think and evolve with a logic to construct an algorithm and pseudocode that can be
converted into a program.
Course Learning Outcomes (CLO):
CLO-1: To solve problems through computer programming. Express the basic data types and
variables in C
                                Part A (10* 1 = 10 Marks)
 Sl.No                                Question                      CO     PO     BL    Marks     PI
                                                                                                CODE
   1     Which of the following is not a valid C variable name?      1      1      1        1    1.6.1
         a) int age;
         b) float salary;
         c) char ch;
         d) int $main;
          Answer: D
   2     What is the output of the following code snippet?           1      2      1        1    2.5.2
                #include <stdio.h>
                 int main()
                 {
                 float s; double a; char b;
                printf("%d", sizeof(s)+sizeof(a)*sizeof(b));
                  return 0;
                 }
           a) 14
           b) 13
           c) 12
           d) Compilation Error
         Answer: C
3   Choose the correct answer.                                  1   2   1   1   2.5.2
    #include <stdio.h>
      int main()
      {
         int value = 350;
         int value = 892;
         printf("SRMIST!%d",value);
         return 0;
      }
            a) SRMIST!350
            b) Redefinition of value
            c) SRMIST!892
            d) SRMIST! Followed by a junk value.
    Answer: B       [Since the value is already defined.
    Redefining it results in an error]
4   #include <stdio.h>                                          1   2   1   1   2.5.2
    int main()
    {
        int x, y = 5, z = 5;
        x = y == z;
        printf("%d", x);
        getchar();
        return 0;
    }
          a) 0
          b) 1
          c) 5
          d) Compile error
     Answer: B
5   After working of the prefix and postfix operators, select   1   2   1   1   2.5.2
    all the correct statements for the code given below:
    Void main() {
    int x, y, z, k;
    x = 10; y = -x; z = x++; k = ++x;
          a) Value of y will be -10 and k will be 12.
          b) Value of z will be 11
          c) Value of k will be 10 and k will be 11
          d) Value of k will be 11
     Answer: A
6    #include <stdio.h>                                  1   2   2   1   2.5.2
     // Assume base address of "GeeksQuiz" to be 2000
     int main()
     {
        printf(5 + "GeeksQuiz");
        return 0;
      }
      a) GeeksQuiz
      b) Quiz
      c) 2005
      d) Compile time error
           Answer: B
7.                                                       1   2   1   1   2.5.2
     C is a ___ language
     a) High Level
     b) Low Level
     c) Middle Level
     d) Machine Level
     Answer: C
8.                                                       1   2   1   1   2.5.2
      The equality operator is represented by
      a) :=
      b) .EQ.
      c) =
      d) = =
      Answer: D
9.                                                       1   2   3   1   2.5.2
     What will be the output of the expression 11 ^ 5?
     a) 5
     b) 6
     c) 11
     d) 13
     Answer: D
              10.                                                               1   2      2    1      2.5.2
                    The operator + in a+=4 means
                    a) a=a+4
                    b) a+4=a
                    c) a=4
                    d) a=4+4
                    Answer: A
                                          Part B (5* 2 = 10 Marks) Answer all questions
Sl.No                                 Question                                  CO PO     BL   Marks   PI
                                                                                                       Code
 11      #include <stdio.h>                                                     1   2      3     2      2.6.3
        int main(){
        char operator = ‘+’;
        int num1 =12;
        int num2 = 10;
        int result = (operator ==’+’_____________);
        // Complete the statement by using ternary operator to get the result
        = 22, if not result = 2 .
        printf(“%d”, result);
        return 0;
        }
        Answer: int result = (operator ==’+’) ? (num1 + num2) : (num1 –
        num2);
 12      Illustrate the available datatype modifiers in C?                      1   2      2     2       2.6.3
              Answer:
               signed - It is default modifier of int and char data
               type if no modifier is specified. It says that user
               can store negative or positive values.
              unsigned - It is used on int and char data type. It
               says that user can store only positive values.
              short - It limits user to store small int values and
               occupies 2 bytes of memory space in every
               operating system. It can be used only on integer
               data type.
              long - This can be used to increased size of
               the int or double data types to 2 more bytes.
 13 Pick the correct one from the following declaration is not                  1   2      2     2      2.6.3
        supported by C language?
     a) String str;
     b) char *str;
     c) float str = 3e2;
     d) Both String str; & float str = 3e2;
     Answer: A
14    Conclude the output of the following c program?                      1       2       3       2    2.6.3
      #include <stdio.h>
      int main()
      {
       int a=5;
      int b=10;
      int c;
      c=a+b;
       printf("%i", c);
      return 0;
      }
       (A) 5
      (B) 10
       (C) 15
      (D) Compilation error
      Answer: (C)
15                                                                         1       2       2       2    2.6.3
      Rushanth is playing with a tennikoit ball (Circle) He knows the
      radius of the ball. Help him to find the area and perimeter of the
      ball using a C program.
        Hint:
          Perimeter of a circle = 2πr
          Area of a circle = πr
                                              Part C (1 * 5 = 5 Marks)
        Sl.No                                 Question                   CO    PO      BL      Marks   PI
                                                                                                       Code
          16                                                               1   2       3       5       2.6.3
                Mithran and Niranjan are two friends. Another friend
                Muthu is facing some issue to pay his tuition fees.
                Therefore, Mithran and Niranjan are giving some
                amount to Muthu to pay the fees. Write a C program
                to calculate how much amount Muthu is going to be
                paid. In addition, draw the flow chart for the same.
                                        (OR)
          17    Kumar had taken the loan amount Rs. 30000 before 3         1   2       3       5       2.6.3
                years in the HDFC bank at 2.5% interest. He went to
                bank for make the payment of his loan. Therefore,
                could you help him to pay the correct amount by
                writing a C program to find the simple interest of his
loan amount?
             Solution:
         #include <stdio.h>
         void main() {
                 float amount, rate, simple_interest;
                 int months;
                printf("Provide amount and interest in
         the format $amount rate%% : ");
         // Read amount and rate using scanf()
                 scanf("$%f %f%%", &amount, &rate);
                 printf("Enter the period in months : ");
                 scanf("%d", &months);
                 simple_interest = amount * rate *
         months / 100 ; // Fill the missing expression to
         calculate simple interest
                printf("Simple interest : %f\n",
         simple_interest);
Course Outcome (CO) and Bloom’s level (BL) Coverage in Questions
             21CSS101J : Programming for Problem Solving- CT 1
                                   CO-Coverage
  100%
   90%
   80%
   70%
   60%
   50%
   40%
   30%
21CSS101J: Programming for Problem Solving CT 1
                Blooms Level %
                                                  BL 1
                        44%
                                                  BL 2
           56%