Professional Documents
Culture Documents
PPS All Unit MCQS'
PPS All Unit MCQS'
CO 4 To decompose a problem into functions and synthesize a complete program using divide and
conquer approach.
CO 5 To use arrays, pointers and structures to develop algorithms and programs.
DETAILED SYLLABUS
Unit Topic
Arrays: Array notation and representation, manipulating array elements, using multi dimensional arrays.
Character arrays and strings, Structure, union, enumerated data types, Array of structures, Passing arrays
IV to functions.
Basic Algorithms: Searching &Basic Sorting Algorithms (Bubble, Insertion and Selection), Finding roots
of equations, Notion of order of complexity.
1 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
7. Functions…………………………………………………………………………….42
11. Pointers…………………………………………………………………………..…..66
2 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
3 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
4 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
5 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
6 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
7 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
8 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
2. Idea of Algorithm
9 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
11 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
12 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
3. Programming Basics
13 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
b) Count_123 (d) $$
c) Count@123 Answer: Option (c)
d) X_123_Count
Answer: Option (c) 17. What will be the output of following program
12. A function #include
a) is a block of statements to perform some main()
specific task {
b) is a fundamental modular unit to perform int x,y = 10;
some task x = y * NULL;
c) has a name and can be used multiple times printf(\"%d\",x);
d) All the above options are true }
Answer: Option (d) (a) error
(b) 0
13. What should be written in the program to get (c) 10
newline on the screen? (d) garbage value
(a) printf("\n"); Answer: Option (a)
(b) echo"\n"
(c) printf('\n'); 18. printf() belongs to which library of c
(d) printf("\n"); (a) stdlib.h
Answer: Option (a) (b) stdio.h
14. A declaration float sum, value; occupies (c) stdout.h
_____ of memory? (d) stdoutput.h
(a) 2 byte Answer: Option (b)
(b) 4 byte 19. What will be printed if we type the statement
(c) 6 byte printf(“%d\n”,’d’);
(d) 8 byte (a) 0
Answer:Option (d) (b) 100
(c) error
15. MACRO is used to _______________. (d) d
(a) Save memory Answer: Option (b)
(b) fast execution
(c) Both a & b 20. Which of the following function is more
(d) none of above appropriate for reading in a multiword string?
Answer: Option (b) (a) printf();
16. Which of the following is a symbol for logical (b) scanf();
AND operator? (c) gets();
(a) II (d) puts();
(b) & Answer: Option (c)
(c) &&
14 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
21. What are the different types of real data types Answer: Option (a)
in C? 26. What should be written in the program to get
(a) float, double newline on the screen?
(b) short int, double, long int (a) printf(“\n”);
(c) double, long int, float (b) echo “\n”;
(d) float, double, long double (c) printf(‘\n’);
Answer: Option (d) (d) printf(“ \n “);
22. Which of the following is a correct statement? Answer: Option (a)
(a) Variable name must start with underscore
(b) Variable name must have digit 27. ASCII value of ‘a’ is
(c) Variable name must have white space (a) 97
character (b) 65
(d) Keyword cannot be a variable name (c) 47
Answer: Option (d) (d) None of the above
Answer: Option (a)
23. What will be the output of following code. 28. A float requires ______bytes in memory
{ (a) 2 bytes
int x = 10, y=15; (b) 1 byte
x = x++; (c) 8 bytes
y = ++y; (d) 4 bytes
printf(“%d, %d \n” , x, y); Answer: Option (d)
} 29. Which of the following operator is used to
(a) 10, 15 select a member of a structure variable
(b) 10, 16 (a) .(dot)
(c) 11, 16 (b) ,(comma)
(d) 11, 15 (c) : (colon)
Answer:Option (b) (d) ;(semicolon)
24. Any C program Answer: Otion (a)
(a) Must contain at least one function
(b) Need not contain any function 30. What is the starting point of C program
(c) Needs input data execution?
(d) None of the above (a) #include
Answer:mOption (a) (b) void main()
(c) Opening curly braces ‘{‘
25. Which is a correct ‘C’ expression? (d) None of these
(a) z = (x+y); Answer: Option (b)
(b) z = [x+y];
(c) z = {x+y}; 31. Which symbol ends a statement in C
(d) z = {(x+y)}; program?
15 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
(a) . (full stop) 37. Which of the following is true for variable
(b) ; (semicolon) names in C?
(c) : (colon) (a) Variable names cannot start with a digit
(d) } (curly braces) (b) Variable can be of any length
Answer: Option (b) (c) They can contain alphanumeric characters
32. Which symbol is used to comment single as well as special characters
statement? (d) Reserved word can be used as a variable
(a) // name
(b) \ Answer: Option (a)
(c) /*
(d) \* 38. Character literal in C syntax is?
Answer: Option (a) (a) Z
33. Why preprocessor directive needed in the (b) ‘Z’
beginning of a C program? (c) “Z”
(a) To start execution of a program (d) None of these
(b) To include keywords in a program Answer: Option (b)
(c) To include files in a program 39. Choose the correct statement about C escape
(d) None of these sequences
Answer: Option (c) (a) \n produces a new line
34. Header file is compulsory to include in a C (b) \t produces one tab space (white spaces)
program printing “Hello World” (c) \b produces one backspace
(a) True (d) All of these
(b) False Answer: Option (d)
Answer: Option (a) 40. Choose a valid C format specifier
35. Which of the following is not a basic data (a) %d prints integer constants
type in C language? (b) %f prints float constants
(a) float (c) %c prints character constants
(b) int (d) All of these
(c) real Answer: Option (d)
(d) char 41. When we write X=10 and Y=X, which of the
Answer: following memory assignment is correct
Option (c) a) X and Y will have same location and 10
36. How many keywords are there in C? will be stored.
(a) 31 b) X and Y will have two distinct locations
(b) 32 and 10 will be stored in both.
(c) 64 c) X and Y will have same location and
(d) 63 only X will contain value 10
Answer: Option (b) d) X and Y will have two distinct locations
and only X will contain value 10
16 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
17 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
18 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
19 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
19. What will be the output of following 23. Within a expression, _________
program precedence operators will be evaluated
#include<stdio.h> first
void main() (a) Similar
{ (b) Higher
int x,y=10; (c) Lower
x = y * NULL; (d) None of these
printf("%d",x); Answer: Option (b)
}
(a) error
(b) 0 24. What will the value of variable a?
(c) 10 int a = 10 + 2 * 12 / (3*2) + 5;
(d) garbage value (a) 31
Answer: Option (a) (b) 19
20. Which of following is not a valid (c) 11
assignment expression? (d) 29
(a) y = 22; Answer: Option (b)
(b) s = x; 25. Which of the following correctly shows
(c) y%=6; the hierarchy of arithmetic operation in
(d) z = 5 = 3; C?
Answer: Option (d) (a) /+*-
21. An arithmetic expression without (b) *-/+
paranthesis will be evaluated from left to (c) /*+-
right (d) +-/*
(a) True Answer: Option (c)
(b) False 26. Which of the following are incorrect
Answer: Option (a) statements?
22. In C Programming, the statement a = a+1 1. if(a==7) printf("IncludeHelp");
and a+=1 will produe same result 2. if(7==a) printf("IncludeHelp");
(a) True 3. if(a=7) printf("IncludeHelp");
(b) False 4. if(7=a) printf("IncludeHelp");
Answer: Option (a) a) 1 and 2.
b) 3 only.
c) 4 only.
20 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
21 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
22 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
23 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
24 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
(b) 19
62. Within an expression, __________ (c) 11
precedence operators will be evaluated (d) 29
first Answer: Option (b)
(a) Similar 67. Which of the following correctly shows
(b) Higher the hierarchy of arithmetic operations in
(c) Lower C?
(d) None of these (a) / + * -
Answer: Option (b) (b) * - / +
(c) / * + -
63. What will the value of variable a? (d) + - / *
int a = 4 + 4/2*5 + 20; Answer: Option (c)
(a) 40 68. In the following expression guess the
(b) 4 correct order of execution of operator
(c) 34 z=x-y/z*1%2+1
(d) 54 (a) / * % - + =
Answer: Option (c) (b) * / % - + =
64. What will the value of variable a? (c) = / * - % +
int a = 10 + 5 * 2 * 8 / 2 + 4; (d) = / * % - +
(a) 124 Answer: Option (a)
(b) 54 69. What is the output?
(c) 23 void main()
(d) 404 {
Answer: Option (b) int i=0, j=1, k=2, m;
65. What will the value of variable a? m = i++ || j++ || k++;
int a = 4 + 5/2*10 + 5; printf("%d %d %d %d", m, i, j, k);
(a) 29 }
(b) 5 (a) 1 1 2 3
(c) 4 (b) 1 1 2 2
(d) 34 (c) 0 1 2 2
Answer: Option (a) (d) 0 1 2 3
Answer: Option (b)
66. What will the value of variable a?
int a = 10 + 2 * 12 /(3*2) + 5; 70. What is the output?
(a) 31 void main()
25 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
{ b) 2
int x = 1, y = 2; c) 3
printf("%d", x, y); d) 4
} Answer: Option (b)
(a) 1 2
(b) 1
(c) 2
(d) Error 73. Which conversion also called Automatic
Answer: Option (b) Type Conversion?
71. Which of the following statement is a) Implicit Type Conversion
correct? b) Explicit Type Conversion
a) Operator precedence determines c) Both A and B
which operator is performed first d) None of the above
in an expression with more than Answer: Option (a)
one operator with different 74. The following code is an example of?
precedence. Associativity is used double da = 4.5;
when two operators of same double db = 4.6;
precedence appear in an double dc = 4.9;
expression
b) Operator associativity determines //explicitly defined by user
which operator is performed first int result = (int)da + (int)db + (int)dc;
in an expression with more than printf(""result = %d"", result);
one operator with different a) Implicit Type Conversion
associativity. Precedence is used b) Explicit Type Conversion
when two operators of same c) Error
precedence appear in an d) Can not Say
expression Answer: Option (b)
c) Operator precedence and
associativity are same. 75. What will be output for the following
d) None of the above code?
Answer: Option (a) #include<stdio.h>
72. How many type of conversion are there in int main()
c? {
int x = 10;
a) 1 char y = 'a';
26 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
27 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
5. Conditional Branching
int x = 1;
a) if else if (x > 0)
c) conditional operator }
a) True Answer: a
b) False
5. What will be the output of the following C
Correct Option : a
code?
3. If you have to make decision based on
#include <stdio.h>
multiple choices, which of the following is
int main()
best suited?
{
a) if
int x = 0;
b) if-else
if (x++)
c) if-else-if
printf("true\n");
d) All of the above
else if (x == 1)
Correct Option : c
printf("false\n");
4. What will be the output of the following C
}
code?
a) true
#include <stdio.h>
b) false
int main()
c) compile time error
{
28 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
d) undefined behaviour }
a) false, 0
Answer: b
b) true, 0
6. What will be the output of the following C
c) true, 10
code?
d) compile time error
#include <stdio.h>
int main() Answer: b
{
8. What will be the output of the following C
int x = 0;
code?
if (x == 1)
if (x == 0) #include <stdio.h>
printf("inside if\n");
int main()
else
{
printf("inside else if\n");
else int x = 0;
printf("inside else\n");
if (x == 1)
}
if (x >= 0)
a) inside if
printf("true\n");
b) inside else if
else
c) inside else
printf("false\n");
d) compile time error
}
Answer: c
a) true
7. What will be the output of the following C
b) false
code?
c) Depends on the compiler
#include <stdio.h>
int main() d) No print statement
{
Answer: d
int x = 0;
9. Which of the following is an invalid if-else
if (x == 0)
printf("true, "); statement?
else if (x = 10)
a) if (if (a == 1)){}
printf("false, ");
b) if (func1 (a)){}
printf("%d\n", x);
29 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
30 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
31 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
32 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
a) 1 4
b) Compilation error
c) 1 2 4
d) 1 3 4
Answer a
22. What will be the output of the following C
code?
(Assuming that we have entered the value 1 in
the standard input)
int main()
{
33 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
d) None of them {
c) Condition statement i = i + 1;
c) to stop the current iteration and begin d) loop will not be executed
34 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
35 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
c) Error if (x == 5)
d) Random Behavior printf("hi");
Answer: Option (b) else
14. What is the output? printf("no");
void main() }
{
if(1 || 0) (a) hi
printf("C Programming"); (b) hello
else (c) no
printf("learn C"); (d) error
} Answer: Option (a)
(a) learn C 17. What is the output?
(b) Compile Error void main()
(c) C Programming {
(d) Error int x = 5;
Answer: Option (c) if (true);
15. What is the output? printf("hello");
void main() }
{
int x= 5; a) hello
if(x < 1); b) Error
printf("Hello"); c) Blank
printf("Hi"); d) None of these
} Answer: Option (a)
a) Hi 18. What is the output?
b) HelloHi void main()
c) Error {
d) None of these int x = 0;
Answer: Option (b) if (x == 0)
16. What is the output? printf("hi");
void main() else
{ printf("how are u");
int x = 5; printf("hello");
if (x < 1) }
printf("hello");
36 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
37 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
38 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
39 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
40 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
41 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
7. Functions
1. What is the default return type if it is not 6. A function prototype is used for
specified in function definition? a) Declaring the function logic
(a) void b) Calling the function from the main
(b) int body
(c) float c) Telling the compiler, the kind of
(d) None of these arguments used in the function
Answer: Option (b) d) Telling the user for proper use of
2. Every C Program should contain which syntax while calling the
function? Answer: Option (c)
(a) printf() 7. What is the default return type if it is not
(b) show() specified in function definition?
(c) scanf() a) void
(d) main() b) integer
Answer: Option (d) c) double
d) float
3. Any C Program Answer: Option (b)
(a) Must contain at least one function
(b) Need not contain any function 8. What is the return type of the function
(c) Needs input data with declaration:
(d) None of these int func(char x, float v, double t);
Answer: Option (a) (a) char
4. Function have______ (b) int
(a) Local scope (c) float
(b) Block scope (d) double
(c) File scope Answer: Option (b)
(d) No scope 9. Which of the following is a valid function
Answer: Option (c) call (assuming the function exists)?
5. Which is not a correct function (a) funct;
declaration? (b) funct x, y;
(a) int funct(char x, char y); (c) funct();
(b) double funct(x) (d) int funct();
(c) void funct(); Answer: Option (c)
(d) char x(); 10. In C, function parameters are always
Answer: Option (b) (a) Passed by value
42 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
43 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
18. Choose the correct statement about 21. What is the output?
Functions in C int show()
a) A Function is a group of C {
statements that can be reused any return 10;
number of times. }
b) Every Function has a return type. void main()
c) Every Function may not return a {
value. int a;
d) All the these printf("COUNT=");
Answer: Option (d) a=show();
printf("%d", a);
19. What is the output? }
void show();
void main() (a) COUNT=
{ (b) COUNT=0
show(); (c) COUNT=10
printf("WORLD "); (d) Error
} Answer: Option (c)
void show() 22. What is the output?
{ int show()
printf("HELLO "); {
} return 15;
(a) WORLD HELLO return 35;
(b) HELLO WORLD }
(c) WORLD void main()
(d) Error {
Answer: Option (b) int a;
20. How many values can a C Function return printf("COUNT=");
at a time? a=show();
(a) Only one value printf("%d", a);
44 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
45 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
46 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
47 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
48 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
49 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
(d) 1000
Answer: Option (a)
50 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
51 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
52 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
53 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
54 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
(a) Programming in C {
(b) P char str[2];
(c) Programming int i=0;
(d) Compiler error scanf("%s", str);
Answer: Option (a) while(str[i] != '\0')
31. What is the output? {
void main() printf("%c", str[i]); i++;
{ }
char str[25]; }
scanf("%s",str); //Input: INDIA
printf("%s",str);
} (a) IN
//input: Programming in C (b) I
(c) INDIA
(a) Programming in C (d) Compiler error
(b) P Answer: Option (c)
(c) Programming
(d) Compiler error 34. How do you accept a multi-word input in C
Answer: Option (c) language.?
(a) scanf()
32. What is the output? (b) gets()
void main() (c) getc()
{ (d) None of these
char str[]={"C","A","T","\0"}; Answer:
printf("%s",str); Option (b)
} 35. Choose the correct C sentence about
strings.
(a) C (a) printf() is capable of printing a multi-
(b) CAT word string.
(c) CAT\0 (b) puts() is capable of printing a multi-
(d) Compiler error word string.
Answer: Option (d) (c) gets() is capable of accepting a multi-
word string.
33. What is the output? (d) All of these
void main() Answer: Option (d)
55 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
56 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
57 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
printf("%d",s.no); s.no = 8;
} printf("%d",s.no);
(a) 8 }
(b) Compiler error (a) 8
(c) Blank (b) Compiler error
(d) Runtime error (c) Blank
Answer: Option (a) (d) Runtime error
Answer: Option (b)
9. What is the output? 11. Which of the following accesses a variable
struct student in structure b?
{ (a) b->var;
int no = 5; (b) b.var;
char name[20]; (c) b-var;
}; (d) b>var;
void main() Answer: Option (b)
{ 12. Which of the following accesses a variable
struct student s; in structure *b?
s.no = 8; (a) b->var;
printf("%d",s.no); (b) b.var;
} (c) b-var;
(a) 8 (d) b>var;
(b) Compiler error Answer: Option (a)
(c) 5
(d) Runtime error 13. What is the output?
Answer: Option (b) struct pens
{
10. What is the output? int color;
struct student }p1[2];
{ void main()
int no; {
char name[20]; struct pens p2[3];
}; p1[0].color=5;
void main() p1[1].color=9;
{ printf("%d, ",p1[0].color);
student s; printf("%d",p1[1].color);
58 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
} {
(a) 5, 5 printf("%d %d\n", p[0].x, p[1].y);
(b) 5, 9 printf("%d %d\n", p[2].x, p[3].y);
(c) 9, 5 }
(d) Compiler error
Answer: Option (b) (a) 1 2
14. What is the output? 34
struct student (b) 1 0
{ 20
char *name; (c) Compiler Error
}; (d) Blank
struct student s[2]; Answer: Option (a)
void main()
{ 16. The correct syntax to access the member of
s[0].name = "alan"; the ith structure in the array of structures
s[1] = s[0]; is?
printf("%s %s", s[0].name, s[1].name); struct temp
s[1].name = "turing"; {
printf("\n%s %s", s[0].name, int b;
s[1].name); }s[50];
} (a) s.b.[i];
(b) s.[i].b;
(a) alan alan alan turing (c) s.b[i];
(b) alan alan turing turing (d) s[i].b;
(c) alan turing alan turing Answer: Option (d)
(d) None of these 17. What is the output?
Answer: Option (a) void main()
{
15. What is the output? struct book
struct point {
{ int pages;
int x; };
int y; struct book b,*ptr;
} p[] = {1, 2, 3, 4}; b.pages = 100;
int main() ptr = &b;
59 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
60 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
61 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
62 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
1. The worst-case occur in linear search 5. The Average case occurs in the linear
algorithm when ……. search algorithm ……….
a) Item is somewhere in the middle of a. when the item is somewhere in the
the array middle of the array
b) Item is not in the array at all b. when the item is not the array at all
c) Item is the last element in the array c. when the item is the last element in the
d) Item is the last element in the array or array
item is not there at all d. Item is the last element in the array or
item is not there at all
Answer: Option (d)
Answer: Option (a)
2. If the number of records to be sorted is 6. When the Binary search is best applied to
small, then …… sorting can be efficient. an array?
a) Merge a) For very large size array
b) Heap b) When the array is sorted
c) Selection c) When the array elements are mixed
d) Bubble data type
d) When the array is unsorted
Answer: Option (c) Answer: Option (b)
3. The complexity of the sorting algorithm
measures the …… as a function of the 7. Consider the array A[]= {5,4,9,1,3} apply
63 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
12. Sorting algorithm can be characterized as 16. ………. is putting an element in the
which are out of order, until no such pairs Answer: Option (d)
remain.
a) Insertion 23. Which of the following is not the required
b) Exchange condition for a binary search algorithm?
c) Selection a) The list must be sorted
d) Distribution
b) There should be direct access to the
Answer: Option (b)
middle element in any sublist
19. ………… is the method used by card c) There must be a mechanism to delete
sorter. and/or insert elements in the list.
d) Number values should only be present
a) Radix sort
b) Insertion Answer: Option (c)
c) Heap
d) Quick
24. Partition and exchange sort is ……..
Answer: Option (a) a) quick sort
b) tree sort
c) heap sort
20. Which of the following sorting algorithm is d) bubble sort
65 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
11. Pointers
1. If ptr is a pointer to int, having value 4. Pointer variable is declared using preceding
ptr=100. After ptr++, what is the value of _________ sign
ptr? a) %
(a)100
b) &
(b)101
c) *
(c)102
d) ^
(d)103
Answer: Option (c)
Answer: Option (c)
5. Address stored in the pointer variable is of
2. A Pointer is? type ________
(a)A keyword used to create variables. (a) Integer
66 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
67 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
68 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
(d) ce to integers
69 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
70 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
71 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
72 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
(a) 0
(b) -1
(c) 10
(d) NULL
Answer: Option (c)
44. What is the output?
void main()
{
int *ptr;
ptr = (int *)calloc(1,sizeof(int));
printf("%d\n",*ptr);
}
(a) 0
(b) -1
(c) Error
(d) Null
Answer: Option (a)
73 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
74 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
(d) bit file (a) fscanf() can read from standard input
Answer: Option (c) whereas scanf() specifies a stream
9. getc() returns EOF when from which to read
(a) end of files is reached (b) fscanf() can specifies a stream from
(b) When getc() fails to read a character which to read whereas scanf() can read
(c) Both A and B only from standard input
(d) None of these (c) fscanf() and scanf() has no difference
Answer: Option (c) in their functions
(d) fscanf() and scanf() can read from
10. A data of the file is stored in___ specified stream
(a) RAM Answer: Option (b)
(b) ROM 14. What does the following C statement
(c) Hard disk mean?
(d) None of these char *gets(char *s)
Answer: (a) Reads the next input line into the array
Option (c) (b) Writes the line into the array s.
(c) Reads the next input character into the
11. Select a function which is used to write a array s.
string to a file______ (d) Write a character into the array.
(a) pits() Answer: Option (a)
(b) putc()
(c) fputs() 15. Which function will return the current file
(d) fgets() position for stream?
Answer: (a) fgetpos()
Option (c) (b) fseek()
(c) ftell()
12. fflush(NULL) flushes all ________ (d) fsetpos()
(a) input streams Answer: Option (c)
(b) output streams
(c) previous contents 16. Choose a correct statement about C file
(d) appended text mode "a".
Answer: Option (b) FILE *fp;
fp=fopen("abc.txt","a");
13. Choose the right statement for fscanf() and
scanf()
75 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
76 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
77 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
27. How will you free the memory allocated by a) #define INCH PER FEET 12
the following program? b) #define SQR(X) (X *X);
c) #define SQR(X) X*X
#include <stdio.h> d) #define SQR(X) (X*X)
#define CONDITION(x)
printf("letsfindcourse"); Answer: Option (d)
int main()
{ 30. A macro must always be written in capital
CONDITION(0); letters.
return 0;
} a) TRUE
a) Runtime Error b) May Be
b) letsfindcourse c) FALSE
c) Compilation error d) Can't Say
d) None of the above Answer: Option (c)
Answer: Option (b)
31. A macro should always be accommodated
in a single line.
a) TRUE
b) May Be
28. What is a preprocessor directive c) FALSE
a) a message from compiler to the d) Can't Say
programmer Answer: Option (a)
78 University Academy
PROGRAMMING FOR PROBLEM SOLVING 2020-21
79 University Academy