Online Test

:

 

Find the output of below programs.

A. #include<stdio.h>
    int main()
    {
      printf("%d\n",x);
      return 0;
    }
    int x;
  B. #include<stdio.h>
      int main()
     {
       extern int x;
       printf("%d\n",x);
       return 0;
     }
     int x;

String operation such as strcat(s, t), strcmp(s, t), strcpy(s, t) and strlen(s) heavily     rely upon.


Which of the following range is a valid long double (Turbo C in 16 bit DOS OS) ?

 


What is the output of the following program?

#include<stdio.h>
int main()
{
  char str[2];
  printf("\nEnter the string : ");
  gets(str);
  printf("%s\t%s",str,(str+5));
}
//Input:
//Enter the string : Hi Tech Epi

Point out the correct statement which correctly allocates memory dynamically for 2D array following program?

#include<stdio.h>
#include<stdlib.h>
int main()
{
    int *p, i, j;
    /* Add statement here */
    for(i=0; i<3; i++)
    {
        for(j=0; j<4; j++)
        {
            p[i*4+j] = i;
            printf("%d", p[i*4+j]);
        }
    }
    return 0;
}

Which of the following function is more appropriate for reading in a multi-word string?


Which of the following statements correct about the below program?

#include<stdio.h>

int main()
{
    union a
    {
        int i;
        char ch[2];
    };
    union a u1 = {512};
    union a u2 = {0, 2};
    return 0;
}
1: u2 CANNOT be initialized as shown.
2: u1 can be initialized as shown.
3: To initialize char ch[] of u2 '.' operator should be used.
4: The code causes an error 'Declaration syntax error'

 If the file name is enclosed in angle brackets


What will be the output of the program?

#include<stdio.h>
void fun(int);
typedef int (*pf) (int, int);
int proc(pf, int, int);
int main()
{
    int a=3;
    fun(a);
    return 0;
}
void fun(int n)
{
    if(n > 0)
    {
        fun(--n);
        printf("%d,", n);
        fun(--n);
    }
}

 


There is a error in the below program. Which statement will you add to remove it?

#include<stdio.h>
int main()
{
    int a;
    a = f(10, 3.14);
    printf("%d\n", a);
    return 0;
}
float f(int aa, float bb)
{
    return ((float)aa + bb);
}

Point out the error in the following program.

#include<stdio.h>
#include<stdlib.h>
int main()
{
    static char *p = (char *)malloc(10);
    return 0;
}

Point out the error in the following code?

typedef struct
{
    int data;
    NODEPTR link;
}*NODEPTR;

Point out the error in the program

#include<stdio.h>
#define SI(p, n, r) float si; si=p*n*r/100;
int main()
{
    float p=2500, r=3.5;
    int n=3;
    SI(p, n, r);
    SI(1500, 2, 2.5);
    return 0;
}

Which of the following statements are correct about the program?

#include<stdio.h>
int main()
{
    printf("%p\n", main());
    return 0;
}

 


The below two lines are equivalent to
#define C_IO_HEADER 
#include C_IO_HEADER

 

About Us

TechEpi.com is an online learning website.We cover the latest tech news,online tutorials,blog,online test for Aptitude,C,Java,PHP to improve your knowledge.

Newsletter


Follow TechEpi on