1 / 20

Understanding C Programming Concepts through Practical Examples

This document explores various C programming concepts using a series of practical code examples. Each example illustrates specific functionalities, such as mathematical functions (`ceil`, `floor`), conditional statements (`if`, `switch`), unary operators, and array manipulations. Additionally, it covers unique topics like memory addressing, size calculation in arrays, and string manipulations. By examining these examples, learners can gain a better grasp of C programming syntax and behavior, aiding in their proficiency in coding.

yuki
Télécharger la présentation

Understanding C Programming Concepts through Practical Examples

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TECHNICAL QUESTIONS #include<stdio.h> void main() { float x = 1.66, y = 1.75; printf(“%f%f”,ceil(x), floor(y)); }

  2. TECHNICAL QUESTIONS #include<stdio.h> void main() { int x = 10, y =20; if(!(!x) && x) printf(“x = %d”,x); else printf(“y = %d“,y); }

  3. TECHNICAL QUESTIONS #include<stdio.h> void main() { int a = 500, b=100,c; if(!a >= 400) b = 300; c = 200; printf(“b = %d c = %d”,b,c); }

  4. TECHNICAL QUESTIONS #include<stdio.h> void main() { int a = 10,b; a >= 5 ?b=100 :b=200; printf(“%d”,b); }

  5. TECHNICAL QUESTIONS Which of the following cannot be checked in a switch - case statement? Character Integer Float

  6. TECHNICAL QUESTIONS Which of the following are unary operators in C? ! sizeof ~ && =

  7. TECHNICAL QUESTIONS #include<stdio.h> void main() { static int a[20]; int i = 0; a[i] = i++; printf(“%d%d%d”,a[0],a[1],i); }

  8. TECHNICAL QUESTIONS #include<stdio.h> void main() { int I = 3; i = i++; printf(“%d”,i); }

  9. TECHNICAL QUESTIONS #include<stdio.h> void main() { int x = 4,y,z; y = --x; z = x--; printf(“%d%d%d”,x,y,z); }

  10. TECHNICAL QUESTIONS #include<stdio.h> void main() { int x = 55; printf(“%d%d%d”,x<=55,x=40,x>=10); }

  11. TECHNICAL QUESTIONS #include<stdio.h> #define SQR(x) (x * x) void main() { int a, b =3; a = SQR(b+2); printf(“%d”,a); }

  12. TECHNICAL QUESTIONS #include<stdio.h> void main() { int arr[1] = {10}; printf(“%d”, 0[arr]); }

  13. TECHNICAL QUESTIONS If the array begins at address 1200 in memory, what will be the output of the program? #include<stdio.h> void main() { int a[] = {1,2,3,4,5}; printf(“%u%u%u”,arr,&arr[0],&arr); }

  14. TECHNICAL QUESTIONS #include<stdio.h> void main() { float a[] = {1.2,2.4,3.5,4.5}; printf(“%d”, sizeof(a) / sizeof(a[0])); }

  15. TECHNICAL QUESTIONS #include<stdio.h> void main() { printf(“%c”, “abcdefgh”[4]); }

  16. TECHNICAL QUESTIONS #include<stdio.h> void main() { printf(5 + “Fascimile\n”) } o/p : mile

  17. TECHNICAL QUESTIONS #include<stdio.h> void main() { int I; printf(“%d”, scanf(“%d”,&i)); }

  18. TECHNICAL QUESTIONS #include<stdio.h> void main() { char p[] = “%d\n”; p[1] = ‘c’; printf(p,65); }

  19. TECHNICAL QUESTIONS #include<stdio.h> void main() { char str[10] = “Angel”; str[6] = ‘d’; printf(“%s”,str); } o/p : Angel

  20. TECHNICAL QUESTIONS #include<stdio.h> void main() { char str[] = “Sales\0man\0”; printf(“%s”,str); } o/p : Sales

More Related