We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
Reg.
Number:
Continuous Assessment Test (CAT) – I - AUGUST 2024
Programme : B. Tech. (ECE/ECM) Semester : FS 2024-25 Course Code & BECE320E Embedded C : Class Number : CH2024250102674 Course Title Programming Faculty : Prof. Srinivasan R Slot : E1 Duration : 90 Minutes Max. Marks : 50 General Instructions: • Write only your registration number on the question paper in the box provided and do not write other information. • Only non-programmable calculator without storage is permitted.
Answer all questions.
Sub Blooms Q. No Description Marks Sec. Taxonomy Level Write appropriate declarations in C and assign the given initial values for each variable or array. (i) Integer variables: u = 421 (octal), y = fa01 (hexadecimal) (a) 3 L1 (ii) One-dimensional character array: message = “We are safe.” 1. (iii) Double precision variable: reading1 = 3.56218 × 10-4 Evaluate the following expression in C. float value = (i - 3 * j) % (c + 2 * d) / (x - y) if (b) 2 L2 int i=10, j=5; float x = 0.005, y = -0.01; char c = ‘c’, d = ‘d’. ASCII value of ‘c’ = 99, ‘d’ = 100 What is the output of the following code? #include <stdio.h> int main( ) { (a) int k, num = 65 ; 2 L1 k = ( num > 5 ? ( num <= 10 ? 100 : 200 ) : 500 ) ; printf ( "%c %d\n", num, k ) ; return 0 ; } 2. What is the output of the following code? #include<stdio.h> int main () { printf("Hello!\bHow are you?\n"); (b) printf("I\tam feeling good.\n"); 3 L2 printf("I am feeling\r good\n"); printf("\nI am feeling \\\'good\'\n"); return 0; } Write a C program to read the age of 100 persons and count the 3. (a) number of persons in the age group 50 to 60. Use for and 5 L3 continue statements. Write a C program using do-while loop to ask the user to enter (b) numbers continuously until 0 and print the count of positive and 5 L3 negative numbers at the end of the program. Write a C program to print a diamond pattern of numbers for a given number of rows using appropriate loops. e.g. For n=3, the pattern is 1 4. 10 L3 123 12345 123 1 What is the output of the following code? #include <stdio.h> void main () { int a, b = 0, d=0; static int c[10] = {2, 3, 8, 0, 1 , 4, 5, 6 , 9, 7}; for (a = 0; a < 10; ++a){ if ((c[a] % 2) == 1) { 5. 5 L4 b += c[a]; printf("%d, ",c[a]); } } if(a % 2 == 0) d += a; printf("\n%d\n", b); printf("%d", d); } What is the output of the following code? #include <stdio.h> #include <string.h> char *p = "Hello world"; int main(void) { 6. int t; 5 L2 printf("%d\n",*p); printf("%c\n",*p+1); printf("%c\n",*(p+1)); for(t=strlen(p)-1; t>1; t--) printf("%c", p[t]); return 0; } The Chebyshev polynomials of the first kind can be calculated using the following recurrence relations: T0(x) = 1, T1(x) = x, Tn(x) = 2xTn-1(x) – Tn-2(x) for n=2, 3, 7. 4,…and x is any floating point number between -1 and 1. Write a 10 L3 C program to generate the first n Chebyshev polynomials. The values of n and x should be input parameters. The code should check that n is a positive integer and x is between -1 and 1 only. **********All the best *************