Welcome to Your Quiz: Aptitude Test C Programming For Intermediate Students Level 2

Name Email
1.

If the different command line arguments are supplied at different times would the output of the following program change?
#include<stdio.h>
int main(int argc, char **argv)
{
printf("%d\n", argv[argc]);
return 0;
}

(Visited 18 times, 1 visits today)
2.

What will be the output of the program in Turbo-C ?
#include<stdio.h>
int main()
{
int arr[5], i=-1, z;
while(i<5)
arr[i]=++i;
for(i=0; i<5; i++)
printf("%d, ", arr[i]);
return 0;
}

(Visited 18 times, 1 visits today)
3.

What will be the output of the program?
#include<stdio.h>
typedef struct error {int warning, err, exception;} ERROR;
int main()
{
ERROR e;
e.err=1;
printf("%d\n", e.err);
return 0;
}

(Visited 18 times, 1 visits today)
4.

What will be the output of the program assuming that the array begins at the location 1002 and size of an integer is 4 bytes?
#include<stdio.h>
int main()
{
int a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
printf("%u, %u, %u\n", a[0]+1, *(a[0]+1), *(*(a+0)+1));
return 0;
}

(Visited 18 times, 1 visits today)
5.

Which standard library function will you use to find the last occurance of a character in a string in C?

(Visited 18 times, 1 visits today)
6.

What will be the output of the program?
#include<stdio.h>
int main()
{
const int i=0;
printf("%d\n", i++);
return 0;
}

(Visited 18 times, 1 visits today)
7.

A structure can contain similar or dissimilar elements

(Visited 18 times, 1 visits today)
8.

What will be the output of the program in 16-bit platform (Turbo C under DOS) ?
#include<stdio.h>
int main()
{
printf("%d, %d, %d", sizeof(3.0f), sizeof('3'), sizeof(3.0));
return 0;
}

(Visited 18 times, 1 visits today)
9.

Which of the following statements correct about k used in the below statement?
char ****k;

(Visited 18 times, 1 visits today)
10.

What will be the output of the program if value 25 given to scanf()?
#include<stdio.h>
int main()
{
int i;
printf("%d\n", scanf("%d", &i));
return 0;
}

(Visited 18 times, 1 visits today)
11.

What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample friday tuesday sunday
/* sample.c */
#include<stdio.h>
int main(int argc, char *argv[])
{
printf("%c", *++argv[2] );
return 0;
}

(Visited 18 times, 1 visits today)
12.

A pointer union CANNOT be created

(Visited 18 times, 1 visits today)
13.

Point out the error in the program?
#include<stdio.h>
#include<stdlib.h>
int main()
{
unsigned char;
FILE *fp;
fp=fopen("trial", "r");
if(!fp)
{
printf("Unable to open file");
exit(1);
}
fclose(fp);
return 0;
}

(Visited 18 times, 1 visits today)
14.

Data written into a file using fwrite() can be read back using fscanf()

(Visited 18 times, 1 visits today)
15.

What does the following declaration mean?
int (*ptr)[10];

(Visited 18 times, 1 visits today)
16.

Even if integer/float arguments are supplied at command prompt they are treated as strings.

(Visited 18 times, 1 visits today)
17.

Point out the error in the program?
#include<stdio.h>
int main()
{
struct emp
{
char name[20];
float sal;
};
struct emp e[10];
int i;
for(i=0; i<=9; i++)
scanf("%s %f", e[i].name, &e[i].sal);
return 0;
}

(Visited 18 times, 1 visits today)
18.

What will be the output of the program (sample.c) given below if it is executed from the command line (turbo c under DOS)?
cmd> sample Good Morning
/* sample.c */
#include<stdio.h>
int main(int argc, char *argv[])
{
printf("%d %s", argc, argv[1]);
return 0;
}

(Visited 18 times, 1 visits today)
19.

What is output of below program?
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
    char temp[20];
    gcvt(23.45, 3, temp);
    printf("%s", temp);
    return 0;
}

(Visited 18 times, 1 visits today)
20.

What will be the output of the program?
#include<stdio.h>
#define PRINT(i) printf("%d,",i)
int main()
{
int x=2, y=3, z=4;
PRINT(x);
PRINT(y);
PRINT(z);
return 0;
}

(Visited 18 times, 1 visits today)

Thank You for Submitting your response for Quiz

Aptitude Test C Programming For Intermediate Students Level 2

Please click on View Result Button to see the Result.



(Visited 18 times, 1 visits today)
Show Buttons
Hide Buttons