Pds End Term
Pds End Term
Pds End Term
B. rem = 3/2;
C. rem = 3%2;
Answer: Option C
C. - (hyphen) D. _ (underscore)
View Answer:
Answer: Option D
Answer: Option B
1:
struct book
{
char name[10];
float price;
int pages;
};
2:
long int l = 2.35;
A. 1 B. 2
Answer: Option B
A. Declaration B. Definition
C. Function D. Error
View Answer:
Answer: Option A
1 : extern int x;
2 : float square ( float x ) { ... }
3 : double pow(double, double);
A. 1 B. 2
C. 1 and 3 D. 3
View Answer:
Answer: Option C
7. In the following program where is the variable a getting defined and where it is getting declared?
#include<stdio.h>
#include<conio.h>
int main()
{
extern int a;
printf("%d\n", a);
return 0;
getch();
}
int a=20;
Answer: Option A
Answer: Option B
#include<stdio.h>
#include<conio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("PDS");
}
return 0;
getch();
}
C. 0 times D. 10 times
View Answer:
Answer: Option C
10. How many times the while loop will get executed if a short int is 2 byte wide?
#include<stdio.h>
#include<conio.h>
int main()
{
int j=1;
while(j <= 255)
{
printf("%c %d\n", j, j);
j++;
}
return 0;
getch();
}
A. Infinite times B. 255 times
Answer: Option B
C. || D. !
View Answer:
Answer: Option A
12. In mathematics and computer programming, which is the correct order of mathematical operators
?
A. Addition, Subtraction, Multiplication, Division
B. Division, Multiplication, Addition, Subtraction
View Answer:
Answer: Option B
Answer: Option C
A. */%+-= B. =*/%+-
C. /*%-+= D. *%/-+=
View Answer:
Answer: Option A
C. +-/* D. /*+-
View Answer:
Answer: Option D
return
C. a>b?(c=30):(c=40) D.
(a>b)?(a:b)
View Answer:
Answer: Option C
17. Which of the following is the correct order if calling functions in the below code?
a = f1(23, 14) * f2(12/4) + f3();
A. f1, f2, f3
B. f3, f2, f1
D. None of above
Answer & Explanation
Answer: Option C
1. !
2. sizeof
3. ~
4. &&
A. 1, 2 B. 1, 3
C. 2, 4 D. 1, 2, 3
View Answer:
Answer: Option D
1. Relational
2. Arithmetic
3. Logical
4. Assignment
A. 2134 B. 1234
C. 4321 D. 3214
View Answer:
Answer: Option A
20.What will be the output of the program?
#include<stdio.h>
#include<conio.h>
int main()
{
int i=-3, j=2, k=0, m;
m = ++i && ++j && ++k;
printf("%d, %d, %d, %d\n", i, j, k, m);
return 0;
getch();
}
A. -2, 3, 1, 1 B. 2, 3, 1, 2
C. 1, 2, 3, 1 D. 3, 3, 1, 2
View Answer:
Answer: Option A
#include<stdio.h>
#include<conio.h>
int main()
{
printf("%x\n", -2<<2);
return 0;
getch();
}
A. Ffff B. 0
C. fff8 D. Error
View Answer:
Answer: Option C
#include<stdio.h>
#include<conio.h>
int main()
{
int i=-3, j=2, k=0, m;
m = ++i || ++j && ++k;
printf("%d, %d, %d, %d\n", i, j, k, m);
return 0;
getch();
}
A. 2, 2, 0, 1 B. 1, 2, 1, 0
C. -2, 2, 0, 0 D. -2, 2, 0, 1
View Answer:
Answer: Option D
#include<stdio.h>
#include<conio.h>
int main()
{
int x=12, y=7, z;
z = x!=4 || y == 2;
printf("z=%d\n", z);
return 0;
getch();
}
A. z=0 B. z=1
C. z=4 D. z=2
Answer & Explanation
Answer: Option B
#include<stdio.h>
#include<conio.h>
int main()
{
static int a[20];
int i = 0;
a[i] = i ;
printf("%d, %d, %d\n", a[0], a[1], i);
return 0;
getch();
}
A. 1, 0, 1 B. 1, 1, 1
C. 0, 0, 0 D. 0, 1, 0
Answer & Explanation
Answer: Option C
#include<stdio.h>
#include<conio.h>
int main()
{
int i=4, j=-1, k=0, w, x, y, z;
w = i || j || k;
x = i && j && k;
y = i || j &&k;
z = i && j || k;
printf("%d, %d, %d, %d\n", w, x, y, z);
return 0;
getch();
}
A. 1, 1, 1, 1 B. 1, 1, 0, 1
C. 1, 0, 0, 1 D. 1, 0, 1, 1
View Answer:
Answer: Option D
#include<stdio.h>
#include<conio.h>
int main()
{
int i=-3, j=2, k=0, m;
m = ++i && ++j || ++k;
printf("%d, %d, %d, %d\n", i, j, k, m);
return 0;
getch();
}
A. 1, 2, 0, 1 B. -3, 2, 0, 1
C. -2, 3, 0, 1 D. 2, 3, 1, 1
View Answer:
Answer: Option C
27. What will be the output of the program?
#include<stdio.h>
#include<conio.h>
int main()
{
int x=4, y, z;
y = --x;
z = x--;
printf("%d, %d, %d\n", x, y, z);
return 0;
getch();
}
A. 4, 3, 3 B. 4, 3, 2
C. 3, 3, 2 D. 2, 3, 3
View Answer:
Answer: Option D
#include<stdio.h>
#include<conio.h>
int main()
{
int i=3;
i = i++;
printf("%d\n", i);
return 0;
getch();
}
A. 3 B. 4
C. 5 D. 6
View Answer:
Answer: Option B
#include<stdio.h>
#include<conio.h>
int main()
{
int a=100, b=200, c;
c = (a == 100 || b > 200);
printf("c=%d\n", c);
return 0;
getch();
}
A. c=100 B. c=200
C. c=1 D. c=300
View Answer:
Answer: Option C
#include<stdio.h>
#include<conio.h>
int main()
{
int x=55;
printf("%d, %d, %d\n", x<=55, x=40, x>=10);
return 0;
getch();
}
A. 1, 40, 1 B. 1, 55, 1
C. 1, 55, 0 D. 1, 1, 1
View Answer:
Answer: Option A
#include<stdio.h>
#include<conio.h>
int main()
{
int i=2;
printf("%d, %d\n", ++i, ++i);
return 0;
getch();
}
A. 3, 4
B. 4, 3
C. 4, 4
Answer: Option D
#include<stdio.h>
#include<conio.h>
int main()
{
int k, num=30;
k = (num>5 ? (num <=10 ? 100 : 200): 500);
printf("%d\n", num);
return 0;
getch();
}
A. 200 B. 30
C. 100 D. 500
View Answer:
Answer: Option B
#include<stdio.h>
#include<conio.h>
int main()
{
char ch;
ch = 'A';
printf("The letter is");
printf("%c", ch >= 'A' && ch <= 'Z' ? ch + 'a' - 'A':ch);
printf("Now the letter is");
printf("%c\n", ch >= 'A' && ch <= 'Z' ? ch : ch + 'a' - 'A');
return 0;
getch();
}
Answer: Option A
#include<stdio.h>
#include<conio.h>
int main()
{
int i=2;
int j = i + (1, 2, 3, 4, 5);
printf("%d\n", j);
return 0;
getch();
}
A. 4 B. 7
C. 6 D. 5
View Answer:
Answer: Option B
#include <stdio.h>
#include<conio.h>
int main()
int i;
if ((char)a[i] == '5')
printf("%d\n", a[i]);
else
printf("FAIL\n");
getch();
}
ANSWER: D
#include <stdio.h>
void main()
char chr;
chr = 128;
printf("%d\n", chr);
return 0;
A. 128
B. -128
D.error
ANSWER: D
#include <stdio.h>
#include<conio.h>
void main()
int x = 5;
if (x < 1)
printf("hello");
if (x == 5)
printf("hi");
else
printf("no");
getch();
A. hi
B. hello
C. no
ANSWER: A
#include <stdio.h>
int main()
int i = 0;
do {
i++;
getch();
a) 2
b) error
c) 4
d) 1
View Answer
Answer:b
39. How many times i value is checked in the below code?
#include <stdio.h>
#include<conio.h>
int main()
int i = 0;
while (i < 3)
i++;
return 0;
getch();
a) 2
b) 3
c) 4
d) 1
View Answer
Answer:c
#include <stdio.h>
void main()
int i = 2;
do
printf("Hi");
getch();
}
a) Compile time error
b) Hi Hi
c) Hi
d) Varies
View Answer
Answer:a
#include <stdio.h>
#include<conio.h>
void main()
int i = 0;
while (++i)
printf("H");
getch();
a) H
d) Varies
View Answer
Answer:b
#include <stdio.h>
#include<conio.h>
void main()
int i = 0;
do
printf("Hello");
} while (i != 0);
getch();
a) Nothing
c) Hello
View Answer
Answer:c
a) break
b) return
c) exit
View Answer
Answer:b
#include <stdio.h>
int main()
int a = 0, i = 0, b;
a++;
continue;
printf(“%d”,a);
}
a) 2
b) 3
c) 4
d) error
View Answer
Answer:d
#include <stdio.h>
#include<conio.h>
int main()
int i ;
if (i == 3)
break;
printf(“%d”,i);
getch();
a) 1
b) 2
c) 3
d) 4
View Answer
Answer:c
46. Which keyword is used to come out of a loop only for that iteration?
a) break
b) continue
c) return
View Answer
Answer:b
a) switch case
b) if
c) for
View Answer
Answer:d
#include <stdio.h>
void main()
int i = 0;
int j = 0;
if (i > 1)
continue;
printf("Hi \n");
a) Hi is printed 9 times
b) error
c) Hi is printed 7 times
d) Hi is printed 6 times
View Answer
Answer:b
#include <stdio.h>
#include<conio.h>
void main()
int i = 0;
if (i < 4)
printf("Hello");
break;
getch();
c) Hello
View Answer
Answer:c
#include <stdio.h>
#include<conio.h>
void main()
{
void foo();
printf("1 ");
foo();
getch();
void foo()
printf("2 ");
a) 1 2
c) 1 2 1 2
View Answer
Answer:a
#include <stdio.h>
#include<conio.h>
int main()
void foo();
f();
f();
return 0;
getch();
void foo()
printf("2 ");
}
void f()
printf("1 ");
foo();
b) 1212
c) 2 1
View Answer
Answer:b
#include <stdio.h>
int main()
void foo();
void f()
foo();
f();
getch();
void foo()
printf("2 ");
a) 2 2
b) 2
c) Compile time error
View Answer
Answer: c
#include <stdio.h>
#include<conio.h>
void foo();
int main()
foo();
return 0;
getch();
void foo()
printf("2 ");
b) 2
View Answer
Answer:b
#include <stdio.h>
void foo();
int main()
void foo(int);
foo(1);
return 0;
getch();
void foo(int i)
{ printf("2 ");
a) 2
View Answer
Answer:b
#include <stdio.h>
void foo();
int main()
void foo(int);
foo();
return 0;
void foo()
printf("2 ");
a) 2
Answer:b
include <stdio.h>
void m()
printf("hi");
void main()
m();
getch();
a) hi
b) error
c) Nothing
d) Varies
View Answer
Answer: b
#include <stdio.h>
void m();
void n()
m();
void main()
void m()
{
printf("hi");
a) hi
c) Nothing
d) Varies
View Answer
Answer:b
#include <stdio.h>
#include<conio.h>
void main()
m();
getch()’
void m()
printf("hi");
m();
b) hi
c) Infinite hi
d) Nothing
View Answer
Answer:c
#include<conio.h>
void main()
static int x = 3;
x++;
if (x <= 5)
printf("hi");
main();
getch();
b) hi
c) Infinite hi
d) hihi
View Answer
Answer:d
{}
View Answer
Answer:a
a) int 1bhk(int);
View Answer
Answer:d
return (a + b);
{return (a + b);}
c) int sum(a, b)
return (a + b);
View Answer
Answer:b
63. Can we use a function as a parameter of another function? [ Eg: void wow(int func()) ]
b) Yes, but we call the function again to get the value, not as convenient as in using
variable
View Answer
Answer:c
64. The value obtained in the function is given back to main by using ________ keyword?
a) return
b) static
c) new
d) volatile
View Answer
Answer:a
65. What is the output of this C code?
#include <stdio.h>
#include<conio.h>
void main()
char *p = NULL;
char *q = 0;
if (p)
printf(" p ");
else
printf("nullp");
if (q)
printf("q\n");
else
printf(" nullq\n");
getch();
a) nullp nullq
d) p q
View Answer
Answer:a
#include <stdio.h>
void main()
int i = 10;
void *p = &i;
printf("%d\n", (int)*p);
return 0;
a) error
c) 10
d) Undefined behaviour
View Answer
Answer:a
#include <stdio.h>
#include<conio.h>
int main()
int i = 10;
void *p = &i;
printf("%f\n", *(float*)p);
return 0;
getch();
b) Undefined behaviour
c) 10
d) 0.000000
View Answer
Answer:d
#include<stdio.h>
#include<conio.h>
Void main()
Printf(“hhhhhhh”);
getch();
a) h
b) error
c) hhhhhhhhhh
d) Undefined behaviour
View Answer
Answer:b
#include <stdio.h>
int *f();
int main()
int *p = f();
printf("%d\n", *p);
int *f()
int j = 10;
return &j;
a) 10
d) Undefined behaviour
View Answer
Answer:b
70. Comment on the following pointer declaration?
int *ptr, p;
View Answer
Answer: a
#include <stdio.h>
#include<conio.h>
void main()
ptr = &a;
*ptr += 1;
getch();
a) 10,10
b) 10,11
c) 11,10
d) 11,11
View Answer
Answer:d
View Answer
Answer:a
a) &
b) *
c) ->
d) .
View Answer
Answer:b
72. Which of the following does not initialize ptr to null (assuming variable declaration of a
as int) a=0;?
c) int *ptr = a – a;
View Answer:
Answer:a
#include <stdio.h>
#include<conio.h>
int x = 0;
void main()
printf("%p\n", ptr);
x++;
getch();
}
a) Same address
b) Different address
d) Varies
View Answer
Answer:a
#include <stdio.h>
int x = 0;
void main()
printf("%p\n", ptr);
ptr++;
getch();
a) 0 1
c) 00
d) 10
View Answer
Answer:b
#include <stdio.h>
void main()
int x = 0;
ptr++;
getch();
a) 01
b) 10
c) 00
d) error
View Answer
Answer:d
#include <stdio.h>
void main()
int x = 0;
printf("%p\n", ptr);
getch();
a) 5
b) Address of 5
c) Nothing
View Answer
Answer:d
78. What is the output of this C code?
#include <stdio.h>
void main()
int x = 0;
printf("%d\n", *ptr);
getch();
a) Address of x
b) Junk value
c) 0
d) error
View Answer
Answer:d
#include <stdio.h>
#include<conio.h>
void main()
int *p = a;
printf("%p\t%p", p, a);
getch();
View Answer
Answer:a
#include <stdio.h>
#include<conio.h>
void main()
char *s = "hello";
char *p = s;
printf("%p\t%p", p, s);
getch();
d) Nothing
View Answer
Answer:b
#include <stdio.h>
#include<conio.h>
void main()
char *p = s;
getch();
c) h e
d) h l
View Answer
Answer:c
#include <stdio.h>
#include<conio.h>
void main()
. char *p = s;
getch();
a) he
b) ll
c) lo
d) le
View Answer
Answer:d
#include <stdio.h>
#include<conio.h>
void main()
char *p = s;
printf("%c\t%c", 1[p], s[1]);
getch();
a) h h
c) l l
d) ee
View Answer
Answer:d
#include <stdio.h>
#include<conio.h>
int main()
foo(ary);
return 0;
getch();
int i = 10;
p = &i;
a) 10 10
c) 10 1
d) Undefined behaviour
View Answer
Answer:c
#include <stdio.h>
int main()
int *p = ary + 3;
printf("%d\n", p[-2]);
getch();
a) 1
b) 2
View Answer
Answer:c
#include <stdio.h>
int main()
int *p = ary + 3;
getch();
a) 2 3
c) 2 4
d) 2 somegarbagevalue
View Answer
Answer:b
#include <stdio.h>
int main()
printf("%d\n", *ary);
a) 1
d) Undefined variable
View Answer
Answer:a
#include <stdio.h>
int main()
int *p;
p = ary + 3;
*p = 5;
printf("%d\n", ary[3]);
a) 4
b) 5
c) Compile time error
d) 3
View Answer
Answer:c
89. Different ways to initialize an array with all elements as zero are
c) int a = 0, b = 0, c = 0;
View Answer
Answer:d
a) 5, 5, 5, 5, 5
b) 5, 0, 0, 0, 0
View Answer
Answer:b
a) int a = 0, b = 1, c = 2;
b) int size = 3;
int array[size];
c) int size = 3;
View Answer
Answer:c
92. An array of similar data types which themselves are collection of dissimilar data type
are
a) Linked Lists
b) Trees
c) Array of Structure
View Answer
Answer:c
View Answer
Answer:d
#include <stdio.h>
int main()
int p[4];
p = ary;
printf("%d\n", p[1]);
a) 1
c) Undefined behaviour
d) 2
View Answer
Answer:b
95. Which of the following can never be sent by call-by-value?
a) Variable
b) Array
c) Structures
View Answer
Answer:b
96. Which type of variables can have same name in different function:
a) global variables
b) static variables
c) Function arguments
View Answer
Answer:d
97. Arguments that take input by user before running a program are called?
b) main arguments
c) Command-Line arguments
d) Parameterized arguments
View Answer
Answer:c
98. The maximum number of arguments that can be passed in a single function
are_____________
a) 127
b) 253
c) 361
View Answer
Answer:b
1. #include <stdio.h>
3. {
5. }
6. void main()
7. {
8. int a = 6, b = 5;
9. m(&a, &b);
11. }
a) 5 6
b) 6 5
c) 5 5
d) 6 6
View Answer
Answer:a
1. #include <stdio.h>
3. {
4. int i = 0;
6. printf("%d\t", p[i]);
7. }
8. void main()
9. {
12. }
a) 0 0 0 0 0
b) 6 5 3 0 0
d) 6 5 3 junk junk
View Answer
Answer:b
a)0
b)8
c)error
d)none
View Answer
Answer:c
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char name[10]=”monkey”;
char name1[10]=”donkey”;
int j;
j=strcmp(name,name1);
printf(“%d”,j);
getch();
}
a)0
b)9
c)error
d)8
View Answer
Answer:b
a)pointer
b)stack
c)structure
d)union
View Answer
Answer:b
View Answer
Answer:a
ViewAnswer
Answer:c
View Answer
Answer:a
1. #include <stdio.h>
2. #include<conio.h>
3. void main()
4. {
5. int ch;
6. printf("enter a value btw 1 to 2:");
7. scanf("%d", &ch);
8. switch (ch)
9. {
10. case 1:
11. printf("1\n");
12. break;
13. printf("Hi");
14. default:
15. printf("2\n");
16. }
17. getch();
18. }
a)1
b) Hi 2
c) Run time error
d) 2
View Answer
Answer:a
1. #include <stdio.h>
2. #include<conio.h>
3. void main()
4. {
5. int ch;
6. printf("enter a value btw 1 to 2:");
7. scanf("%d", &ch);
8. switch (ch, ch + 1)
9. {
10. case 1:
11. printf("1\n");
12. break;
13. case 2:
14. printf("2");
15. break;
16.
}
getch();
17. }
a)1
b) 2
c) 3
d) Run time error
View Answer
Answer:b
1. #include <stdio.h>
2. void main()
3. {
4. double ch;
5. printf("enter a value btw 1 to 2:");
6. scanf("%lf", &ch);
7. switch (ch)
8. {
9. case 1:
10. printf("1");
11. break;
12. case 2:
13. printf("2");
14. break;
15. }
16. }
a)Compile time error
b) 1
c) 2
d) Varies
View Answe:
Answer:a
1. #include <stdio.h>
2. #include<conio.h>
3. void main()
4. {
5. char *ch;
6. printf("enter a value btw 1 to 3:");
7. scanf("%d", ch);
8. switch (ch)
9. {
10. case "1":
11. printf("1");
12. break;
13. case "2":
14. printf("2");
15. break;
16. }
17. getch();
18. }
a) 1
b) Compile time error
c) 2
d) Run time error
View Answer
Answer:b
1. #include <stdio.h>
#include<conio.h>
2. void main()
3. {
4. int ch;
5. printf("enter a value btw 1 to 2:");
6. scanf("%d", &ch);
7. switch (ch)
8. {
9. case 1:
10. printf("1\t");
11. default:
12. printf("2");
13. }
14. getch();
15. }
a) 1
b) 2
c) 1 2
d) error
View Answer
Answer:c
1. #include <stdio.h>
2. #include<conio.h>
3. void main()
4. {
5. float ch;
6. printf("enter a value btw 1 to 2:");
7. scanf("%f", &ch);
8. switch (ch)
9. {
10. case 1:
11. printf("1\n");
12. break;
13. printf("hi");
14. default:
15. printf("2\n");
16. }
17. getch();
18. }
a) 1
b) hi 2
c) error
d) 2
View Answer
Answer:c
1. #include <stdio.h>
2. void main()
3. {
4. int ch;
5. printf("enter a value btw 1 to 2:");
6. scanf("%d", &ch);
7. switch (ch, ch + 1)
8. {
9. case 1:
10. printf("1\n");
11. break;
12. case 2:
13. printf("2");
14. break;
15. }
16. }
17.
a) 1
b) 2
c) 3
d) can not view any result.
View Answer
Answer:d
1. #include <stdio.h>
2. #include<conio.h>
3. int main()
4. {
5. int a = 10;
6. double b = 5.6;
7. int c;
8. c = a + b;
9. printf("%d", c);
10. }
a) 15
b) 16
c) 15.6
d) error
View Answer
Answer:d
1. #include <stdio.h>
2. int main()
3. {
4. int a = 10, b = 5, c = 5;
5. int d;
6. d = a == (b + c);
7. printf("%d", d);
8. getch();
9. }
a) Syntax error
b) 1
c) 10
d) 5
View Answer
Answer: a
118. What is the output of this C code?
1. #include <stdio.h>
2. int main()
3. {
4. int i = -3;
5. int k = i % 2;
6. printf("%d\n", k);
7. return 0;
getch();
}
a) error
b) -1
c) 1
d) Implementation defined
View Answer
Answer:a
1. #include <stdio.h>
#include<conio.h>
int main()
2. {
3. int i = 3;
4. int l = i / 2;
5. int k = i % 2;
6. printf("%d %d\n", l, k);
7. return 0;
8. getch();
9. }
a) Compile time error
b) 1 1
c) 1 -1
d) Implementation defined
View Answer
Answer:b
120. What is the output of this C code?
1. #include <stdio.h>
#include<conio.h>
int main()
2. {
3. int i = 5;
4. i = i / 3;
5. printf("%d\n", i);
6. return 0;
7. }
a) Implementation defined
b) 1
c) 3
d) not able to view the result
View Answer
Answer:d