SRINIVASA INSTITUTE OF ENGINEERING & TECHNOLOGY(A)
(Approved by AICTE, New Delhi & Permanently affiliated to JNTUK, Kakinada)
(An ISO 9001:2015 Certified Institute & Accredited by NAAC with ‘A’ Grade)
NH-216, CHEYYERU (V), AMALAPURAM-533216)
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Branch: AIML, ECE, EEE Year &Sem: I-I
Faculty: Y. YESU JYOTHI Academic Year: 2022-23
Subject: PPSC Subject code: 21E05101
PROGRAMMING FOR PROBLEM SOLVING USING C – MCQ’S (MULTIPLE CHOICE QUESTIONS)
1. Who is the father of C language?
a) Steve Jobs b) James Gosling c) Dennis Ritchie d) Rasmus Lerdorf
Answer: c
Explanation: Dennis Ritchie is the father of C Programming Language. C programming
language was developed in 1972 at American Telephone & Telegraph Bell Laboratories of
USA.
2. C language was invented in the year.?
A) 1999 B) 1978 C) 1972 D) 1990
Answer: C
3. C Language is a successor to which language.?
A) FORTRAN B) D Language C) BASIC D) B Language
Answer: D
4. C Language is a
a) General Purpose Language b)Case-Sensitive Language
c)Structural Programming d)All the Above
Answer: d
5. Which of the following statement is correct about the C language?
a) The C language is a binary language with some extra features.
b) The C language is a high-level language with some low features.
c) The C language is a mid-level language with some high features.
d) The C language is a low-level language.
Answer: c
Explanation: C is considered a middle-level language because it supports the feature of both
low-level and high-level languages. Today, many programmers refer to C as a low-level
language because it lacks a large runtime system (no garbage collection, etc.). It supports
only scalar operations and provides direct memory addressing.
1
6. Low level language is .?
A) Human readable like language.
B) language with big program size.
C) language with small program size.
D) Difficult to understand and readability is questionable.
Answer: D
Explanation: Looks like raw data often in the form of 1's and 0's.
7. High level language is a .?
A) Human readable like language.
B) language with small program size.
C) language with big program size.
D) language which is difficult to understand and not human readable.
Answer: A
Explanation: Examples are C and BASIC.
8. The purpose of main function is
(a) to stop program execution (b) to stop algorithm
(c) to start algorithm (d) to start program execution
Answer: d
9. C is type of programming language.?
A) Object Oriented B) Procedural C) Bit level language D)
Functional
Answer: B
10. C language was invented to develop which Operating System.?
A) Android B) Linux C) Ubuntu D) Unix
Answer: D
Explanation: C was invented to develop Unix Operating System to overcome compatibility
with different Hardware Platforms.
11. C language is used in the development of .?
A) Databases B) Graphic applications C) Word Processors D) All of the above
Answer: D
Explanation: C language is very efficient in using hardware resources.
12. C Programs are used in .?
A) Any Electronic device which works on some logic and Operating System.
B) Washing machine
C) Fridge, Microwave Ovens
D) All the above.
Answer D
Explanation: C is very fast to execute and safe to embed along with microprocessors.
Device drivers are written in C and C++.
13. Find an integer constant.
A) 3.145 B) 34 C) "125" D) None of the above
Answer B
Explanation: Integer constant is a full or whole number without any decimal point. So 3.14
is a floating point number or Real number.
2
14. Find a Floating Point constant.
A) 12.3E5 B) 12e34 C) 125.34857 D) All the above.
Answer: D
Explanation: Floating Point can be represented in two forms.
1. Fractional Form
eg. 12345.67
2. Exponential Form
(Mantissa)e(number) or (Mantissa)E(number)
eg. 123.4567E2
(e2 = 10 power 2 = 100)
15. Find a Character constant.
A) 'A' B) '1' C) '$' D) All the above.
Answer D
Explanation: A character constant contains only one character within Single Quotes. '
'. Single Quote is typed using Single Quote Double Quote Key near Enter Key in a
Keyboard. Simply it is Right Single Quote.
Left Single Quote looks like this `
Right Single Quote looks like this '
16. A C program is a combination of.?
A) Statements B) Functions C) Variables D) All of the above
Answer: D
17. What is #include <stdio.h>?
a) Preprocessor directive b) Inclusion directive c) File inclusion directive d) None of
the mentioned
Answer: a
18. The C-preprocessors are specified with symbol.
a) # b) $ c) ” ” d) &
Answer: a
Explanation: The C-preprocessors are specified with # symbol.
19. Which of the following is not a valid C variable name?
a) int number; b) float rate; c) int variable_count; d) int $main;
Answer: d
Explanation: Since only underscore and no other special character is allowed in a variable
name, it results in an error.
20. All keywords in C are in
a) LowerCase letters b) UpperCase letters c) CamelCase letters d) None of the mentioned
Answer: a
21. What will be the output of the following C code?
1. #include <stdio.h>
2. int main()
3. {
4. while ()
5. printf("In while loop ");
6. printf("After loop\n");7.
}
3
a) In while loop after loop b) After loop c) Compile time error d) Infinite loop
Answer: C
22. What will be the output of the following C code?#include <stdio.h>
void main()
{
int i = 2;
do
{
printf("Hi");
} while (i < 2)
}
a) Compile time error b) Hi Hi c) Hi d) Varies
Answer: A
23. The return keyword used to transfer control from a function back to the calling function.
A - Yes B - Switch C - go back D - goto
Answer: A
24. What is an example of iteration in C?
a) for b) while c) do-while d) all of the mentioned
Answer: D
25. Which loop is most suitable to first perform the operation and then test the condition?
a) for loop b) while loop c) do-while loop d) none of the mentioned
Answer: C
26. Which keyword can be used for coming out of recursion? (B)
a) break b) return c) exit d) both break and return
27. Which keyword ‘break’ cannot be simply used within (B)
a) do-while b) if-else c) for d) while
28. Which keyword is used to come out of a loop only for that iteration?(B)
a) break b) continue c) return d) none of the mentioned
29. What will be the output of the following C code?(A)
1. #include <stdio.h>
2. void main()
3. {
4. int x = 5;
5. if (x < 1)
6. printf("hello");
7. if (x == 5)
8. printf("hi");
9. else
10. printf("no");
11. }
a) hi b) hello c) no d) error
30. What will be the output of the following C code?(B)
4
1. #include <stdio.h>
2. int x;
3. void main()
4. {
5. if (x)
6. printf("hi");
7. else
8. printf("how are u");9.
}
a) hi b) how are you c ) compile time error d) error
31. What will be the output of the following C code?(B)
1. #include <stdio.h>
2. void main()
3. {
4. int x = 5;
5. if (true);
6. printf("hello");7. }
a) It will display hello b) It will throw an error
c) Nothing will be displayed d) Compiler dependent
32. Which of the following is an invalid if-else statement?(A)
a) if (if (a == 1)){} b) if (func1 (a)){} c) if (a){} d) if ((char) a){}
33. Which datatype can accept the switch statement?(D)
a) int b) char c) long d) all of the mentioned
34. The C code ‘for(;;)’ represents an infinite loop. It can be terminated by (A)
a) break b) exit(0) c) abort() d) terminate
35. What will be the output of the following C code? (C)
1. #include <stdio.h>
2. void main()
3. {
4. double k = 0;
5. for (k = 0.0; k < 3.0; k++);
6. printf("%lf", k);
7. }
a) 2.000000 b) 4.000000 c) 3.000000 d) Run time error
36. What will be the output of the following C code?(A)
1. #include <stdio.h>
2. int main()
3. {
4. int i = 0;
5
5. for (; ; ;)
6. printf("In for loop\n");
7. printf("After loop\n");8.
}
a) Compile time error b) Infinite loop c) After loop d) Undefined behaviour
37. What will be the output of the following C code?(B)
1. #include <stdio.h>
2. int main()
3. {
4. int *p = NULL;
5. for (foo(); p; p = 0)
6. printf("In for loop\n");
7. printf("After loop\n");8.
}
a) In for loop after loop b) Compile time error
c) Infinite loop d) Depends on the value of NULL
38. How many times i value is checked in the following C code?(B)
1. #include <stdio.h>
2. int main()
3. {
4. int i = 0;
5. do {
6. i++;
7. printf("in while loop\n");
8. } while (i < 3);9.
}
a) 2 b) 3 c) 4 d) 1
39. What is an example of iteration in C?(D)
a) for b) while c) do-while d) all of the mentioned
40. Which loop is most suitable to first perform the operation and then test the condition?(C)
a) for loop b) while loop c) do-while loop d) none of the mentioned
41. What is an Array in C language.?[D]
A) A group of elements of same data type.
B) An array contains more than one element
C) Array elements are stored in memory in continuous or contiguous locations.
D) All the above.
42. What are the Types of Arrays.?[D]
A) int, long, float, double
B) struct, enum
C) char
D) All the above
6
43. An array Index starts with.?[B]
A) -1
B) 0
C) 1
D) 2
44. Choose a correct statement about C language arrays.[D]
A) An array size can not changed once it is created.
B) Array element value can be changed any number of times
C) To access Nth element of an array students, use students[n-1] as the starting index is 0.
D) All the above
45. What is the output of C Program.?[D]
int main() { int a[]; a[4] = {1,2,3,4}; printf("%d", a[0]); }
A) 1 B) 2 C) 4 D) Compiler error
46. What is an array Base Address in C language.?[D]
A) Base address is the address of 0th index element.
B) An array b[] base address is &b[0]
C) An array b[] base address can be printed with printf("%d", b);
D) All the above
47. An entire array is always passed by to a called function.[B]
A) Call by value
B) Call by reference
C) Address relocation
D) Address restructure
48. What is the output of C program with arrays.? [D]
int main()
{
int ary(3)=[20,30,40];
printf("%d", a(1));
}
A) 20
B) 30
C) 0
D) Compiler error
49. What is the output of C program with arrays.? [D]
int main()
{
char grade={'A','B','C'};
printf("%c", grade[0]);
}
A) A
B) B
C) C
D) Compiler error
50. What is the value of an array element which is not initialized.?[C]
A) By default Zero 0
B) 1
C) Depends on Storage Class
D) None of the above.
7
51. What happens when you try to access an Array variable outside its Size.?[D]
A) Compiler error is thrown
B) 0 value will be returned
C) 1 value will be returned
D) Some garbage value will be returned.
52. Can we change the starting index of an array from 0 to 1 in any way.?[D]
A) Yes. Through pointers.
B) Yes. Through Call by Value.
C) Yes. Through Call by Reference.
D) None of the above.
53. What is the need for C arrays.?[D]
A) You need not create so many separate variables and get confused while using.
B) Using a single Array variable, you can access all elements of the array easily.
C) Code maintainability is easy for programmers and maintainers.
D) All the above.
54. What is a multidimensional array in C Language.?[D]
A) It is like a matrix or table with rows and columns
B) It is an array of arrays
C) To access 3rd tow 2nd element use ary[2][1] as the index starts from 0 row or column
D) All the above.
55. If an integer array pointer is incremented, how many bytes will be skipped to reach next
element location.?[B]
A) 1
B) 2
C) 8
D) None of the above
56. What is the function used to allocate memory to an array at run time without initializing
array elements.?[B]
A) calloc()
B) malloc()
C) palloc()
D) kalloc()
57. What is the dimension of the C array int ary[10][5].?[B]
A) 1
B) 2
C) 5
D) 10
58. What is the dimension of the below C Array.? [A]
int ary[]={1,3,5,7};
A) 1
B) 2
C) 3
D) 5
8
59. What is the output of C Program with arrays.? [D]
int main()
{
int ary[] = {1, 3, 5};
printf("%d %d", ary[-1], ary[4]);
return 0;
}
A) 1 5
B) 0 0
C) Compiler error
D) None of the above
60. Array of Arrays is also called.?[C]
A) Multi Data Array
B) Multi Size Array
C) Multi Dimensional Array
D) Multi Byte Array