VIGNAN’S INSTITUTE OF ENGINEERING FOR WOMEN
Approved by AICTE, New Delhi, Affiliated to JNTU Kakinada
Kapujaggaraju Peta, VSEZ(Post), Visakhapatnam-530049,AP
DEPARTMENT OF BASIC SCIENCE AND HUMANITIES
MULTIPLE CHOICE QUESTIONS
Course Name: Programming for Problem Solving using C Course Code:C104
Year/Sem: I B.Tech I Sem CSE/ECE/EEE/IT/MECH Regulation: R20
Admitted Batch: 2020 Academic Year:2020-21
Course Coordinators : Mr.M.Srinivasa Rao/ Mrs.K.Guru Lakshmi
Course handled by : Mr. Ch. Sekhar/Mr.M. Srinivasa Rao/Ms.Ch.Usha/
Mrs.K.Guru Lakshmi/Mr.B. Ch.Venkata Ramana
UNIT I
1. Which of the following is a Scalar Data type
A) Float
B) Union
C) Array
D) Pointer
2. Which symbol is used as a statement terminator in C?
A) !
B) #
C) ~
D) ;
3. Which program outputs "Hello World.."?
A) main(){
scanf("Hello World..");
}
B) main(){
printf("Hello World..");
}
C) main(){
print("Hello World..");
}
D) main(){
scan("Hello World..");
}
4. C is a which level language?
A) Low Level
B) High Level
C) Low + High
D) None
5. Character constants should be enclosed between ___.
A) Single quotes
B) Double quotes
C) Both a and
D) None of these
6. Find a correct C Keyword below.
A) breaker
B) go to
C) shorter
D) default
7. Types of Integers are.?
A) short
B) int
C) long
D) All the above
8. Types of Real numbers in C are.?
A) float
B) double
C) long double
D) All the above
9. signed and unsigned representation is available for.?
A) short, int, long, char
B) float, double, long double
C) A & B
D) None of the above
10. Sizes of short, int and long in a Turbo C C++ compiler in bytes are.?
A) 2, 2, 4
B) 2, 4, 4
C) 4, 8, 16
D) 8, 8, 16
11. Which among the following is a Global Variable?
A) register
B) auto
C) static
D) extern
12. What is the default C Storage Class for a variable.?
A) static
B) auto
C) register
D) extern
13. What is the output of the C Program.?
int main()
{
int a=0;
a = 14%-5 - 2;
printf("%d", a);
return 0;
}
A) 0
B) -4
C) -2
D) 2
14. In C language, which Operator group has more priority between (*, / and %) and (+, -)
groups.?
A) Both groups share equal priority.
B) (+, -) > (*, / and %)
C) (+, -) < (*, / and %)
D) None of the above.
15. Associativity of C Operators *, /, %, +, - and = is.?
A) Operators *, / and % have Left to Right Associativity. Operators + and - have Left
to Right Associativity. Operator = has Right to Left Associativitiy.
B) Operators *, / and % have Right to Left Associativity. Operators + and - have Left to
Right Associativity. Operator = has Right to Left Associativitiy.
C) Operators *, / and % have Right to Left Associativity. Operators + and - have Right to
Left Associativity. Operator = has Right to Left Associativitiy.
D) Operators *, / and % have Right to Left Associativity. Operators + and - have Right to
Left Associativity. Operator = has Left to Right Associativitiy.
UNIT II
1. What is the other name for Question Mark Colon Operator.?
A) Comparison Operator
B) If-Else Operator
C) Binary Operator
D) Ternary Operator
2. Choose a statement to use C If Else statement.
A) else if is compulsory to use with if statement.
B) else is compulsory to use with if statement.
C) else or else if is optional with if statement.
D) None of the above
3. Choose a correct C Statement using IF Conditional Statement.
A) if( condition )
{
//statements;
}
B) if( condition )
{
//statements;
}
else
{
//statements;
}
C) if( condition1 )
{
//statements;
}
else if( condition2)
{
//statements;
}
else
{
//statements;
}
D) All the above.
4. What is the output of the C Program.?
int main()
{
if( 4 > 5 )
{
printf("Hurray..\n");
}
printf("Yes");
return 0;
}
A) Yes
B) Hurray..
Yes
C) Hurray..Yes
D) Compiler error
5. What is the output of C Program.?
int main()
{
if( 10 > 9 )
printf("Singapore\n");
else if(4%2 == 0)
printf("England\n");
printf("Poland");
return 0;
}
A) Singapore
B) Singapore
Poland
C) Singapore
England
Poland
D) England
Poland
6. What is the output of C Program.?
int main()
{
int a=9;
if(a=8)
{
printf("Kangaroo\n");
}
printf("Eggs\n");
return 0;
}
A) No output
B) Eggs
C) Kangaroo
Eggs
D) Compiler error
7. What is the Priority of C Logical Operators.? NOT (!), AND (&&) and OR (||)
A) NOT (!) > AND (&&) > OR (||)
B) NOT (!) > AND (&&) = OR (||)
C) AND (&&) > OR (||) > NOT (!)
D) AND (&&) = OR (||) > NOT (!)
8. What is the output of C Program.?
int main()
{
int a=5, b=8;
if( a==5 && (b=9) )
{
printf("Gorilla Glass=");
}
printf("%d %d", a, b);
return 0;
}
A) 5 8
B) 5 9
C) Gorilla Glass=5 8
D) Gorilla Glass=5 9
9. Loops in C Language are implemented using.?
A) While Block
B) For Block
C) Do While Block
D) All the above
10. Which loop is faster in C Language, for, while or Do While.?
A) for
B) while
C) do while
D) All work at same speed
11. Choose correct C while loop syntax.
A) while(condition)
{
//statements
}
B) {
//statements
}while(condition)
C) while(condition);
{
//statements
}
D) while()
{
if(condition)
{
//statements
}
}
12. Which keyword can be used for coming out of recursion?
A) break
B) return
C) exit
D) both break and return
13. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a = 0, i = 0, b;
for (i = 0;i < 5; i++)
{
a++;
continue;
}
}
A) 2
B) 3
C) 4
D) 5
14. The keyword ‘break’ cannot be simply used within _________
A) do-while
B) if-else
C) for
D) while
15. What will be the output of the following C code?
#include <stdio.h>
int main()
{
printf("%d ", 1);
goto l1;
printf("%d ", 2);
l1:goto l2;
printf("%d ", 3);
l2:printf("%d ", 4);
}
A) 1 4
B) Compilation error
C) 1 2 4
D) 1 3 4
UNIT III
1. What is an Array in C language.?
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.
2. What are the Types of Arrays.?
A) int, long, float, double
B) struct, enum
C) char
D) All the above
3. An array Index starts with.?
A) -1
B) 0
C) 1
D) 2
4. Choose a correct statement about C language arrays.
A) An array size cannot change 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
5. The size of a union is determined by the size of the __________
A) First member in the union
B) Last member in the union
C) Biggest member in the union
D) Sum of the sizes of all members
6. What is the output of C program.?
int main() {
float marks[3] = {90.5, 92.5, 96.5};
int a=0;
while(a<3)
{
printf("%.2f,", marks[a]);
a++;
}}
A) 90.5 92.5 96.5
B) 90.50 92.50 96.50
C) 0.00 0.00 0.00
D) Compiler error
7. User-defined data type can be derived by___________
A) struct
B) enum
C) typedef
D) all of the mentioned
8. Which of the following cannot be a structure member?
A) Another structure
B) Function
C) Array
D) None of the mentioned
9. What is a String in C Language.?
A) String is a new Data Type in C
B) String is an array of Characters with null character as the last element of array.
C) String is an array of Characters with null character as the first element of array
D) String is an array of Integers with 0 as the last element of array.
10. Choose a correct statement about C String.
char ary[]="Hello..!";
A) Character array, ary is a string.
B) ary has no Null character at the end
C) String size is not mentioned
D) String can not contain special characters.
11. What is the output of C Program with Strings.?
int main()
{
char ary[]="PPSC";
printf("%s",ary);
return 0;
}
A) D
B) PPSC
C) Discovery
D) Compiler error
12. How do you convert this char array to string.?
char str[]={'g','l','o','b','y'};
A) str[5] = 0;
B) str[5] = '\0'
C) str[]={'g','l','o','b','y','\0'};
D) All the above
13. What will be the output of the following C code?
main()
{
enum resut {pass, fail};
enum result s1,s2;
s1=pass;
s2=fail;
printf("%d",s1);
}
A) error
B) pass
C) fail
D) 0
14. What will be the output of the following C code?
#include <stdio.h>
enum example {a = 1, b, c};
enum example example1 = 2;
enum example answer()
{
return example1;
}
int main()
{
(answer() == a)? printf("yes"): printf("no");
return 0;
}
A) yes
B) no
C) 2
D) error
15. What will be the output of the following C code?
#include<stdio.h>
main()
{
typedef int a;
a b=2, c=8, d;
d=(b*2)/2+8;
printf("%d",d);
}
A) 10
B) 16
C) 8
D) error
UNIT IV
1. What is the base data type of a pointer variable by which the memory would be allocated to it?
A) int
B) float
C) Depends upon the type of the variable to which it is pointing
D) unsigned int
2. In C a pointer variable to an integer can be created by the declaration
A) int p*;
B) int *p;
C) int +p;
D) int $p;
3. A pointer variable can be
A) Passed to a function
B) Changed within a function
C) Returned by a function
D) Can be assigned an integer value
4. What will be the output of the following C code?
void main() {
int a[] = {1,2,3,4,5}, *p;
p = a;
++*p;
printf("%d ", *p);
p += 2;
printf("%d ", *p);
}
A) 24
B) 34
C) 22
D) 23
5. Which of the following statements correct about k used in the below statement?
char ****k;
A) k is a pointer to a pointer to a pointer to a char
B) k is a pointer to a pointer to a pointer to a pointer to a char
C) k is a pointer to a char pointer
D) k is a pointer to a pointer to a char
6. How can you write a[i][j][k][l] in equivalent pointer expression?
A) (((***(a+i)+j)+k)+l)
B) ((**(*(a+i)+j)+k)+l)
C) (*(*(*(a+i)+j)+k)+l)
D) *(*(*(*(a+i)+j)+k)+l)
7. What is the output of this C code?
int main() {
int i = 10;
void *p = &i;
printf("%d\n" (int)*p);
return 0;
A) Compile time error
B) Segmentation fault/runtime crash
C) 10
D) Undefined behaviour
8. What will be the output of the following C code?
void main() {
char *p;
p = "Hello";
printf("%c\n", *&*p);
}
A) Hello
B) H
C) Some address will be printed
D) None of these
9. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int *p = (int *)2;
int *q = (int *)3;
printf("%d", p + q);
}
A) 2
B) 3
C) 5
D) Compile time error
10. Which of the following arithmetic operation can be applied to pointers a and b?
(Assuming initialization as int *a = (int *)2; int *b = (int *)3;)
A) a + b
B) a – b
C) a * b
D) a / b
11. Which of the following declaration will result in run-time error?
A) int **c = &c;
B) int **c = &*c;
C) int **c = **c;
D) none of the mentioned
12. What will be the output of the following C code?
#include<stdio.h>
void main()
{
#ifndef max
printf("hello");
#endif
printf("hi");
}
A) hello
B) hellohi
C) error
D) hi
13. _______________ is the preprocessor directive which is used to end the scope of #ifdef.
A) #elif
B) #ifndef
C) #endif
D) #if
14. The preprocessor directive which checks whether a constant expression results in a zero or non-
zero value __________
A) #if
B) #ifdef
C) #undef
D) #ifndef
15. What will be the output of the following C code?
#include<stdio.h>
#define hello 10
void main()
{
printf("%d",hello);
#undef hello
printf("%d",hello);
}
A) 10
B) hello
C) error
D) 1010
UNIT V
1.A mode which is used to open an existing file for both reading and writing ______
A) ”W”
B) ”W+”
C) ”R+”
D) ”A+”
2. Select a function which is used to read a single character from a file at a time?
A) fscanf()
B) getch()
C) fgetc()
D) fgets()
3. Get input data from datafile and also send output into datafile ,it is called _____
A) files
B) file processing
C) data files
D) file handling
4. which is true about a stream _______
A) It is a general name given to a flow of data
B) It is simply a sequence of bytes
C) It is a logical interface to the data file
D) All of these
5. which is used for the next line marker _______
A)’\r’
B)’\n’
C)’\r’
D)’\0’
6. Which of the following true about FILE *fp
A) FILE is a keyword in C for representing files and fp is a variable of FILE type
B) FILE is a stream
C) FILE is a buffered stream
D) FILE is a structure and fp is a pointer to the structure of FILE type
7. Choose a correct statement about C Function?
void main() {
printf("Hello");
A) "main" is the name of default must and should Function
B) main() is same as int main()
C) By default, return 0 is added as the last statement of a function without specific return type
D) All the above
8. A function which calls itself is called a ___ function.
A) Self Function
B) Auto Function
C) Recursive Function
D) Static Function
9. How many times the program will print " Hello "?
int main() {
printf("Hello");
main();
return 0;
}
A) Infinite times
B) 32767 times
C) 65535 times
D) Till stack overflows
10. Arguments passed to a function in C language are called ___ arguments.
int **a;
A) Formal arguments
B) Actual Arguments
C) Definite Arguments
D) Ideal Arguments
11. What is the default return value of a C function if not specified explicitly?
A) -1
B) 0
C) 1
D) None of the above
12. It is necessary to declare the type of a function in the calling program if the function
A) Is not defined in the same file
B) Returns a non-integer value
C) Both A and B
D) None of the above
13. What is the output of C program with recursive function?
int sum(int x) {
int k = 1
if(x <= 1)
return 1;
k = x + sum(x - 1);
return k;
}
A) 10
B) 11
C) 12
D) 15
14. A recursive function can be replaced with __ in C language.
A) for loop
B) while loop
C) do while loop
D) All the above
15. What will be the value returned by the following function, when it is called with a value 11?
recur(int num() {
if((2) != 0 )
return(recur(2) * 10+num% %2)
else
return 1;
}
A) Function does not return any value, because it goes into an infinite loop
B) 11
C) 1011
D) None of these
Course Coordinator Head of the Department