APTITUDE QUESTION
C Programming
by
3y ago
1) Which operator is used to get the "content of a variable pointed to by a pointer"? 1.Dot Operator (.) 2.Address of Operator (&) 3.Indirection or De-reference Operator (*) 4.Arrow Operator (→) Answer & Explanation: Correct answer: 3 Indirection or De-reference Operator (*) 2) What will be the type of a pointer, which is pointing to an integer variable? 1.int * 2.long int * 3.char * 4.unsigned * Answer & Explanation: Correct answer: 1 int *   To store the address of an integer variable, we need to declare an integer pointer (int *). 3) If ptr is a pointer to one dim ..read more
Visit website
WALK-IN-INTERVIEW
C Programming
by
3y ago
#1: Which is valid C expression? a) int my_num = 100,000; b) int my_num = 100000; c) int my num = 1000; d) int $my_num = 10000; Answer: b Explanation: space, comma and $ cannot be used in a variable name. #2: What is the output of this C code? #include int main() {     printf("Hello World! %d \n", x);     return 0; } a) Hello World! x; b) Hello World! followed by a junk value c) Compile time error d) Hello World!   Answer: c Explanation: It results in an error since x is used without declaring the variable x. #3: What will happen if the below program is ..read more
Visit website
CHALLENGE THIS!!!!!!!
C Programming
by
3y ago
Given three corner points of a triangle, and one more point P. Write a function to check whether P lies within the triangle or not.    B(10,30)            / \           /   \          /     \         /   P   \      P'        /         \ A(0,0) ----------- C(20,0) The p ..read more
Visit website
PRINT ASCII TABLE/ASCII CHART
C Programming
by
3y ago
#include int main() { unsigned char count; for(count=32;count{ printf(" %3d - %c",count,count); if(count % 6==0) printf("\n"); } return 0; } IT REALLY  WORKS....255> ..read more
Visit website
INTERESTING FACT ON C
C Programming
by
3y ago
Below is one of the interesting facts about C programming: 1) The case labels of a switch statement can occur inside if-else statement #include int main() {     int a = 2, b = 2;     switch(a)     {     case 1:         ;         if (b==5)         {         case 2:             printf("GeeksforGeeks");         }     else case 3:     {     }     } } Run on IDE Output :GeeksforGeeks ..read more
Visit website
FACTORIAL
C Programming
by
3y ago
#include int main() {     int n, i;     unsigned long long factorial = 1;     printf("Enter an integer: ");     scanf("%d",&n);     // show error if the user enters a negative integer     if (n < 0)         printf("Error! Factorial of a negative number doesn't exist.");     else     {         for(i=1; i<=n; ++i)         {             factorial *= i;              // factorial = f ..read more
Visit website
        ...
C Programming
by
3y ago
                1.In a file contains the line "I am a boy\r\n" then on reading this line into the array str using fgets(). What will str contain? A.            "I am a boy\r\n\0" B.            "I am a boy\r\0" C.            "I am a boy\n\0" D.            "I am a boy" TRY  IT YOURSELF Answer: Op ..read more
Visit website
MAGIC SQUARE PUZZLE
C Programming
by
3y ago
/*  * C Program to Solve the Magic Squares Puzzle without using   * Recursion  */ #include void magicsq(int, int [][10]); int main( ) {     int size;     int a[10][10];     printf("Enter the size: ");     scanf("%d", &size);     if (size % 2 == 0)     {         printf("Magic square works for an odd numbered size\n");  A   }     else     {         magicsq(size, a);     }     return 0; } void magicsq(int size, int a[][10 ..read more
Visit website
ALGEBRA MAGIC
C Programming
by
3y ago
#include #include int main() {   int x,y;  printf("Think of a munber Between 60 and 100 .\nProvided The number should not consist of the values 0&1.\nPress Enter Key When Ready");  getch();  printf("\nNow add the number with its reverse.\neg.62+26\nif the number you thought was 62.\npress Enter when ready.");  getch();  printf("\nEnter the Middle value of your answer = ");  scanf("%d",&x);  y=100+(x*10)+(x-1);  printf("The value you got is = %d",y);  getch(); } Run this and see the magic ..read more
Visit website
More on printf
C Programming
by
3y ago
What will be the output of following code  #include int main() {          printf("%d",printf("computer"));          return (0 ..read more
Visit website

Follow C Programming on FeedSpot

Continue with Google
Continue with Apple
OR