'C' Programming Test: Questions and Answers.

1. There are total__________main keywords in ‘c’ language.
a.64
b. 31
c. 20
d. 32
Ans: d

2. C language can be used on _______
1. only MS-DOS
2. only Linux.
3.only Windows
4. All of above.
Ans: 4

3. what will be the output of the following program ?

int main()
{
printf(“%f  t  %f”);
}

1. 00.
2. Error.
3.0.000000 0.000000.
4.Blank Output.
Ans: 3

4.What will be the output of the following program.?
int main()
{
while(‘a’ < ‘b’)
{
printf(“India is greatn”);
}
return 0;
}

1. India is great.
2. Compile Error.
3. Infinitely prints “India is great” string.
4. None of above.
Ans: 3

5. What will the output of the following program.?
main()
{
float me=1.1;
double you=1.1;
if(me==you)
printf(“I”);
else
printf(“You”);
}
1.You
2. I
3. I You.
4.Error.
Ans: 1

6. What will the output of the following program.?
main()
{
static int var=5;
printf(“%d “,var–);
if(var)
main();
}

1. 5
2. 4
3. 15
4. 5 4 3 2 1
Ans: 4

7.How much maximum memory can we alllocate in single call to malloc() ?

a. Depends on host system or 64 KB
b.Infinite size.
c.Equal to the Size of RAM.
d.Equal to the size of HDD.
Ans: a

8.what is the purpose of farmalloc() and farfree()?
1. no such functions in C language.
2. same as malloc() and free().
3. used for allocating and releasing block of memory larger than 64KB.
4.  used for allocating and releasing block of memory larger than 56KB.

Ans: 3

9. Which header file should you include if you are to develop a function , which can accept variable number of argument ?
1. vararg.h
2.stdlib.h
3.stdio.h
4.stdarg.h
Ans:4

10.In what form are the library functions provided.
1.source code.
2.object code.
3.byte_code.
4. machine code.
Ans: 2

11. what will be the output of the following program?
#define int char
main()
{
int i=65;
printf(“sizeof(i)=%d”,sizeof(i));
}

output:
1. sizeof(i)=2
2. sizeof(i)=1
3. sizeof(i)=6
4. Error.
Ans: 2

12. r is used for ______
1. linefeed.
2. newline
3. backclash
4. tabspace.
Ans: 1

13.
#define a 10
main()
{
#define a 50
printf(“%d”,a);
}
will it compile successfully ?
1. Yes
2. No
3. Error
4. None of above.
Ans : 1

14.what will be the output of the following program ?
main()
{
main();
}

1. Compile Error.
2. Runtime Error: Stack Overflow
3. Infinite Loop.
4. None of above.

Ans : 2

15. what would be the equivalent pointer expression for reffering the array element a[i][j][k][l]?
a. (*(*(*(a+i)+j)+k)+l)
b.*(*(*(*(a+i)+j)+k)+l)
c. **a[i][j]
d. ***a+i+j+k+k
Ans: b

16.How many bytes are occupied by near,far and huge pointers ?
a. 2 bytes for each.
b. 1byte , 1byte, 2 bytes respectively.
c. 2bytes,4bytes,4 bytes respectively.
d. 4 bytes for each.
Ans: c

17.What will be the output of the following program ?
#include <stdio.h>
int main()
{
printf(“%c n”,7[“Sundaram”]);
return 0;
}

a.7Sumdaram
b.prints 7 times the string Sundaram
c.mSumdaram
d. It would print ‘m’ of Sundaram.
Ans:d

18:Which of the following statements are correct about the code snippet given below ?

int num =10;
k=num>5 ? k=30;;

a. First ‘ ; ‘ is treated as null statement
b. Second ‘ ; ‘ is treated as statement terminator
c. 30 would be assignned to k
d. Compiler would report an error.
Ans : D

19: ANSI C stands for ______
a. All Notationed Standard Indian C
b.Americal National Statard Institute C.
c. American National Standard of Information C.
c.All Nations Standard Information C.

Ans: b

20: what is the root of all modern languages.
a. ALGOL.
b.BASIC.
c.BCPL.
d.ANSI.

Ans: a.

Comments

Popular posts from this blog

MATLAB code for Circular Convolution using Matrix method

Positive number pipe in angular 2+