MALLA REDDY ENGINEERING COLLEGE
(Autonomous)
I.B.Tech.(MR24)(2024-25 AY) I Sem- Question Bank (Objective)
Mid-term Examination –I
Sub: Programming for Problem Solving (PPS) Subject Code: D0501
Q.No MODULE -I Ans
.
Program is a collection of ____. A
1 A. Instructions B. Identifiers C. comments D. None of these
A single binary bit is known as ___________. B
2 A.8bits B.1bit C.1byte D. 1GB
A file name extension for C programming file is ____. D
3 A . .txt B . .doc C. .cpp D. .c
4 ______________a program that translates between programs in high level into object code. C
A.Linkers B.Loaders C.Compilers D.Assemblers
5 Standard input / output library function is called ____and is normally connected to the keyboard. A
A. scanf() B. clrscr() C.printf() D.getch()
6 _____ Function provides for formatted output to the screen. C
A. scanf() B. clrscr() C.printf() D.getch()
In a C program sample code is given below what is output? C
int a=10, b= 2;
7 result = a%b;
printf(“The result is :%d”,result);
A.1 B.2 C.0 D.None
In a C program sample code is given below what is output? int a=10, b= 2; B
8 result = (a>b) ? a: b);
printf(“The result is :%d”,result);
A.2 B.10 C.1 D.5
9 In which of the following operator has highest precedence? A
A.* B.+ C.- D.>
10 In which of the following operator executes from right to left is true? A
A.= B.> C.< D.!
In a the following C program code find the error D
#include<stdio.h>
#include<conio.h>
void main()
11 {
int a=10;
printf(“\n A value is :%f”,a);
}
A.Declaration error B.Compilation error C.Runtime error D.Logical error
In which of the following operator executes from logical operator A
12
A.|| B.| C.& D.^
13 ______ Function provides for getting exactly one character from the keyboard. C
A.putchar() B.puts() C.getchar() D.gets()
14 Identify the octal constant given below C
A.647 B.0x25 C.0743 D.06.25
15 Identify the logical operator given below C
A.:= B.~ C.! D.++
16 Which is one of the size of long double data type? C
A.4bytes B.8 bytes C.10bytes D.6bytes
17 Which is related bit-wise operator? D
A.> B.= C.! D. |
18 Which one of the Assignment operator? A
A.= B.+ C.- D.>
19 Algorithm is ____________process which solves the problems A
A.step-by-step procedure B.sequence of operators C. sequence of variables D.None
20 If x= -4 then y=(x > 1 ? 3 : 4) y=____ C
A.1 B.3 C.4 D.None
21 What is the size of an int data type? D
A.1Byte B.8Byte C.4Byte D.2Byte
22 RAM Stands for______________ C
A.Read available memory B.Reading access memory C.Random access memory D.All of the above
What is the output of this C code? A
#include <stdio.h>
void main()
23 {
int x = 90,y=80;
printf("%d , %d\n", ++x,--y);
}
A.91 , 79 B .79 , 91 C.90 , 79 D.89 , 79
24 Which is not a valid expression? A
A.++(a+b) B.a++ C.--b D.a--
25 The symbol for ternary operator. A
A.? : B.: ? C.: ; D.? ;
26 A block is enclosed with pair of A
A.{ } B. () C.[] D.<>
27 When was the C language developed? B
A.1970 B.1972 C.1971 D.1973
28 The parallelogram symbol is used to representation______. D
A.Start B.Computing C.decision D.Input/output
29 Which is not a key word of C? B
A.Const B.Main C.Sizeof D.Void
C is a______________________. A
30 A.Structured language B. Machine language
C. Assembly language D.Object-oriented language
31 Which one of the following is a float data type? C
A.Int B.long int C.Double D.None of the above
32 Which one of the following is User-defined data type? A
A.Typedef B.Char C. int D.float
33 Which is one of the following is a string constant? B
A. ‘5’ B. “hello” C. ‘d’ D.25
34 The range of values for a char data type is C
A.-32,768 to 32,768 B.0 to 255 C.-128 to 127 D.0 to 65535
35 a+=1 will result in___________. D
A.a= a-1 B.a= 1+1 C.a=a+a D.a=a+1
36 Which of the following is the bitwise left shift operator C
A.<<< B.> C.<< D.>>>
37 Which function is used for reading data from keyboard in C language? C
A.printf() B.clrscr() C.Scanf() D.None
38 __________is the interface between user and hardware. A
A.Operating system B.Mother board C.Keyboard D.RAM
39 Which is one of the 125 decimal number to binary number? B
A.1011010 B.1111101 C.0001101 D.1111011
40 If a=20, b=10 then result of ++a,--b is _________. C
A.20,10 B.21,10 C.21,9 D.9,21
41 Who developed the C language? B
A.Ken Thompson B.Dennis Ritchie C.Kernighan Ritchie E.Balagurusamy
42 ________is a pictorial representation of an algorithm. B
A.Program B.Flowchart C.Language D.Instruction
43 Algorithm written in English like language is called___. C
A.object code B.source code C.pseudo code D. machine code
44 Identifiers are a_____________. B
A.Keywords B.User_defined names C.Constants D.all of the above
45 Which is one of the Hexa decimal integers constant? B
A. 07777 B.0xFFFF C.-7777 D.777.77
46 The execution of a program written in C language begins at: A
A.main() B)scanf() C)printf() D)clrscr()
47 Type conversion is also called __________. C
A.Evaluation B.expression C. type casting D. all of the above
48 Which of the following is the correct statement for computing logical AND? B
A.a<b & x>y B.a<b && x>y C. a<b || x>y D.a<b AND x>y
49 The equal to operator is represented by ______. C
A.:= B.!= C.== D.=
50 Which is one of the format descriptor a new line? A
A.\n B.\t C.\a D.\v
MODULE-II
How many times the for loop is executed? A
#include<stdio.h>
main(){
51 int i;
for(i=0;i<=5;i++);
printf("%d",i);
}
A.6 B.7 C.8 D.None
What will be output of following c code? A
#include<stdio.h>
main(){
int i;
for(i=0;i<=5;i++)
52 {
break;
printf("%d",i);
}
}
A.Nil B.12345 C.0 D.5
What will be output of following c code? A
#include<stdio.h>
main(){
53 int i=2,j=2;
while(i==2?--i:j++)
printf("%d",i);
}
A.1 B.2 C.4 D.None
What will be output of following c code? A
#include<stdio.h>
main(){
54 for(;;) {
printf("%d ",10);
}
}
A.Infinite Loop B.10 C.1 to 10 D.None
55 What will be output of following c code? A
#include<stdio.h>
main(){
int i;
for(i=0;i<=5;i++)
printf("%d",i);
}
A.012345 B.123 C.5 D.None
What will be output of following c code? A
#include <stdio.h>
void main()
{
int x = 5;
if (x < 1)
56 printf("hello");
if (x == 5)
printf("hi");
else
printf("no");
}
A.hi B.Hello C.No D.None
What will be output of following c code? D
#include <stdio.h>
void main()
{
int x = 0;
57 if (x == 0)
printf("hi");
else
printf("how are u");
printf("hello");
}
A.hi B.how are you C.Hello D.Hihello
What will be output of following c code? A
#include <stdio.h>
void main()
{
58 int x = 5;
if (x < 1);
printf("Hello");
}
A.Nothing B.Run time error C.Hello D.Varies
What will be output of following c code? A
#include <stdio.h>
void main()
{
double ch;
printf("enter a value btw 1 to 2:");
scanf("%lf", &ch);
switch (ch)
59 {
case 1:
printf("1");
break;
case 2:
printf("2");
break;
}
}
A.Compile time error B.1 C.2 D.None
60 _________________ Statement is must within the end of each case in switch case statements. B
A.Continue B.Break D.Default D.None
61 Case Labels must ends with _____________ delimiter. A
A. : B.; C.! D.@
62 Case label should not be ______________. B
A.Integer B.Floating point number C.Character D.None of the above
63 __________ Operators are not allowed in Switch Statement. A
A.Relational B.Arithmetic C. Const Variable D. None of the Above
How many times printf() statement is executed? B
#include <stdio.h>
int main()
{
int i = 0;
64 while(i<3) {
i++;
printf("in while loop\n");
}
}
A.2 B.3 C.4 D.1
How many times i value is checked in the below code? B
#include <stdio.h>
int main()
{
int i = 0;
65 do {
i++;
printf("in while loop\n");
} while (i < 3);
}
A.2 B.3 C.4 D.1
What will be output of following c code? A
#include <stdio.h>
void main()
{
int i = 2;
66 do
{
printf("Hi");
} while (i < 2)
}
A.Compile time error B.Hi Hi C.Hi D.Varies
What will be output of following c code? C
#include <stdio.h>
void main()
{
int i = 0;
67 do
{
printf("Hello");
} while (i != 0);
}
A.Nothing B. H is printed infinite times C.Hello D. Run time error
What will be output of following c code? A
68 #include <stdio.h>
void main()
{
int k = 0;
for (k)
printf("Hello");
}
A.Compile time error B.hello C. Nothing D.Varies
What will be output of following c code? A
#include <stdio.h>
void main()
{
69 int k = 0;
for (k < 3; k++)
printf("Hello");
}
A.Compile time error B. Hello is printed thrice C. Nothing D. Varies
___________ is a looping statement that will always executes at least ones, before the test is made to B
70 determine whether it should continue
A.While B.Do While C.For D.None
71 The _________ statement terminates the loop immediately when it is encountered. C
A.Continue B.Go to C.Break D.None
72 The ______ statement skips some statements inside the loop. A
A.Continue B.Go to C.Break D.None
73 _____________ Transfers control to the labeled statement. B
A.Continue B.Go to C.Break D.None
74 Ternary operator Exp1?Exp2:Exp3; is similar to ____________ decision making statement. A
A.If else B.Else if ladder C.Nested if D.Simple if
What will be output of following c code? A
#include<stdio.h>
main(){
75 int i=2;
(i<=2)?printf(“Success”):printf(“Fail);
}
A.Success B.Fail C.Error D.None
Char data type is used to store? A
76
a) character b) string c)integer d) valueless
1. Which of the following is a user defined data type? D
77
a)enum b)union c)struct d)All of the above
Which is correct with respect to size of the datatypes? C
78
a)char>int>float b)int>char>float c)char<int<double d)double>char>int
Floating point values denote _______ values by default? A
79 a) 0.0f b) 0.0d c)null d)0
80 How many keywords present in the C language? C
A.30 B.31 C.32 D.33
How many bytes of memory is used to store unsigned long int? A
81
a) 8 b) 2 c)3 d)4
_______ refers to changing a variable of one data type into another C
82 a)letters b) numbers c) type casting d) None of the mentioned
What will be the output of the following C code? D
83
void main()
{
const int k = 5;
k++;
printf(“%d”,k);
}
a) 6
b) Error due to constant succeeding int
c) Error because a constant variable can be changed only twice
d) Error because a constant variable cannot be changed
Output of the code is A
Float salary = 10000.00;
Int sal;
84
Sal = (int)salary;
a)10000 b)10000.00 c)100 d)100.00
_________ lower level data type is converted to higher type A
a) implicit type conversion b) explicit type casting
85
c) both a & b d) None of the above
_____ is a preprocessor command used to fix a value to a variable A
86 a)#define b)#include c)Both [A]&[B] d)None of the above
Printf function stands for B
87 a)print function b)print formatting c) both a & b d)None of the above
_______ is used to read formatted data from the keyboard D
88 a) char b) int c) printf() d) scanf()
result of printf(“the number is 2%d”, 1234); A
89 a) 1234 b) 12 c) 123 d)34
control string used for unsigned decimal value C
90 a) %d b)%s. c)%u d) %f
If the values of a = 1234 and b = 5678 output of below code is B
int a,b;
printf(“enter four digit numbers”);
91 scanf(“%2d %4d”,&a,&b);
printf(“the two numbers are %d and %d”,a,b);
a) 1234 and 5678 b)12 and 34 c)both a and b d)none of the above
The new line \n doesn’t work in the following printf statement. B
92 A.printf(“hello \t world \n”); B.printf(“hello \0 world \n”);
C.printf(“hello \r world \n”); D.printf(“hello \? world \n”);
Which of the following cannot be checked in a switch-case statement? C
93
a)character b)integer c)float d)enum
A switch statement is used to: C
a) Switch between function in a program
94 b) Switch from one variable to another variable
c) To choose from multiple possibilities which may arise due to different values of a single variable
d) To use switching variable
Which is the alternative to SWITCH in C language? D
95
a) IF b) ELSE c) IF-ELSE d) else-if-ladder
Which is/are the integer constant/constants? D
96 a)Decimal integer constant b)Octal integer constant
c)Hexadecimal constant c)All of the above
What is the result after execution of the following code if a=10, b=5, c=10? [B] B
if((a>b) && (a<=c))
97 a=a+1;
else
c=c+1;
a)a=10,c=10 b)a=11, c=10 c) a=10, c=11 d) a=11, c=11
The C statement “ ” if(a==1||b==2){}”” can be written as__________ D
a) a) if(a==1)
if(b==2)()
b) b) if(a==1){}
98
if(b==2){}
c) c) if(a==1){}
else if(b==2){}
d) d) none of the mentioned
Functions have….. C
99 a)local scopr b)block scope c)file scope d)function scope
100 When a function is recursively called all the automatic variables are stored in a A
a)stack b)queue c)array d)register
MODULE-III
The recursive functions are executed in a….. C
101 a)parallel order b)first in first out order
c)last in first out order d)random order
Which of the following is a complete function? C
102 a)int funct(); b)void funct(int) {printf(“hello”);}
c)int funct(int x) (return x=x+1;) d)none of these
Which of the following is true about return type of functions in C? A
a) Functions can return any type
103 b) Functions can return any type except array and functions’
c) Functions can return any type except array, functions and union
d) Functions can return any type except array, functions, function pointer and union
Use of functions D
a)helps to avoid a set of statements many times
104 b)enhances the logical clarity of the program and makes the debugging task easier
c)helps to avoid repeated programming across programs
d)all of the above
105 Any C program A
a)must contain at least one function
b)need not contain any function
c)needs input data
d)none of the above
What is a function? D
a)function is a block of statements that perform some specific task
106 b)function is the fundamental modular unit. A function is usually designed to perform a specific task.
c)function is a block of code that performs a specific task. It has a name and it is reusable.
d)all of the above
The default parameter passing mechanism is A
107 a)call by value b)call be reference
c)call by value result d)none of the above
Pick the correct statements: C
I. The body of a function should have only one return statement.
II. The body of a function may have many return statements
108 III. A function can return only one value to the calling environment
IV. If return statement is omitted, then the function does its job but returns no value to the calling
environment.
a) I and II b)I and III c)II and III d)II and IV
What is the output of the following code? A
#include<stdio.h>
main( )
{
109 int a=3,b;
b=3+a++;
printf(“%d”, b);
}
a)6 b) 7 c) 4 d)None
110 The function that is invoked in known as C
a)calling function b)caller function c)called function d)invoking function
111 Function declaration statement identifies a function with its D
a)name b)arguments c) data type of return value d)all the above
112 Which return type cannot return any value to the caller? C
a)int b)float c)void d)double
113 The default storage class of global variable is D
a)auto b)static c)register d)extern
114 The function int funct(); takes ______ arguments A
a)int b)float c)char d)string
115 main() is called by______ D
a)compiler b)linker c)loader d)Operating System
Variable declared inside a function is known as_____ B
116 a)global variables b)local variables
c)both a and b d)none of the above
Output of an arithmetic expression with integers and real numbers is ___ by default? B
117 a) Integer b) Real number
c) Depends on the numbers used in the expression d) None of the above
118 Pick up the odd one out from the following D
a) a=a+1; b) a+=1; c) a++; d)a=+1;
A typecast is used to: B
a) Define a new data type
119 b) Force a value to be of a particular variable type
c) Rename an old type
d) None of these
An Identifier is a _________ D
120 a) Name of a Function or Variable
b) Name of a Macros
c) Name of Structure or Union
d) All the above.
Each statement in a C program should end with? A
121
a) Semicolon; b) Colon: c) Period . (dot symbol) d) None of the these.
ASCII stands for_____ C
a) American Stating Code For Internet Interchange
122 b) American Stating Code For Information Interchange
c) American Standard Code For Information Interchange
d) American Standard Code For Internet Interchange
Pick a low-level language from the following A
a) machine language
123 b) Assembly language
c) C++
d) Java
Variables in the C program can’t start with ——? C
a)Special characters except for the underscore
b)Numbers
124
c)Both a & b
d)None of the above
Which data type variable uses %i in the C program: A
a)Integer variable b)float variable
125
c)string variable c)All of the above
Course Coordinator Dean-I Yr