Question Bank - EC-208 - Programming Concepts
Question Bank - EC-208 - Programming Concepts
Question Bank
Course Code :
Course Name :
EC-208
Credits : 4
Date : 15.12.2016
PROGRAMMING CONCEPTS
1&2
Q. No.
Question
UNIT-1
Max.
marks
1
Difficulty
Index
A
#include <stdio.h>
int main()
{
int main = 3;
printf("%d", main);
return 0;
}
a) It will cause a compile-time error
b) It will cause a run-time error
c) It will run without any error and prints 3
d) It will experience infinite looping
9
10
11
12
#include <stdio.h>
int main()
{
int ThisIsVariableName = 12;
int ThisIsVariablename = 14;
printf("%d", ThisIsVariablename);
return 0;
}
a) The program will print 12
b) The program will print 14
c) The program will have a runtime error
d) The program will cause a compile-time
error due to redeclaration.
An assembly language is a
1
a) low level programming language
b) Middle level programming language
c) High level programming language
d) Internet based programming language
Variables created in MATLAB can be seen in 2
_______________.
Programming in _______________________are 2
A
A
13
14
15
16
17
18
difficult to modify.
________________is a program that translate
mnemonic
statements
into
executable
instructions.
The program which acts as a interface between a
user and a the hardware is called an
__________________.
The Kite Box in Flowchart is used for depicting
____________ Statements.
Structured program can be easily broken down
into routines or _______that can be assigned to
any number of programmers.
A group of 4(four) bits is called a ___________.
The ______________ is a program planning tool
that allows the programmers to plan program
logic by writing program instruction in an
ordinary language.
2
2
A
B
19
20
2
2
A
B
4
4
A
B
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Unit-1
Question
No.
1
2
3
4
5
6
7
8
9
10
11
Answer
(c). Problem Identification
(c). According to the syntax for C variable name, it cannot start with a digit.
(d). Since only underscore and no other special character is allowed in a variable
name, it results in an error.
Answer: c
Answer: d
Answer: a
Answer: a
Answer: c
Explanation: A C program can have same function name and same variable name.
Output: 3
Answer: b
Explanation: Variable names ThisIsVariablename and ThisIsVariableName are
both distinct as C is case sensitive.
Output: 14
Answer: a
Workspace
12
13
14
15
16
17
18
19
20
Unit
2
Q. No.
Questions
A GUI:
a) uses buttons, menus, and icons.
b) should be easy for a user to manipulate.
c) stands for Graphic Use Interaction.
d) Both a and b.
IDE is:
a) Independent Development Enterprise
b) A development environment for machine
language
c) An Integrated Development Environment
for Visual Basic
d) A software project management tool
Which of the following is not part of the IDE:
a) Code editor window
b) Properties window
c) Form layout window
d) General window
The application name always appears in the:
a) Properties window
b) Title bar
c) Intermediate window
d) Code window
In the IDE, which of following is used to design
the layout of an application?
a) Form Designer window
b) Project Explorer window
c) Context Menu
d) Form Layout window
Testing helps to ensure _______of the program
for use within a system:
a) Quality, accuracy and except
b) Quality, accuracy and acceptance
c) Design, assurance and acceptance
d) Quality, accuracy and development
UNIT-2
Max.
marks
1
Difficulty
Index
A
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
documentation only.
Differentiate between testing and debugging.
What is the importance of documentation in
computer program?
What is IDE? Write a short note on it.
Write short note on Graphical User Interface
(GUI).
Explain the need for Program Documentation.
Explain Interpreter.
Explain the Compiler.
Discuss the various features of a GUI. Illustrate
some steps to design a GUI for Starting and
Stopping an Induction Motor.
What is Syntax Error?
What is a logical Error?
How will you Debug a Program? Illustrate with
examples.
What will you do if you encounter a Compiler
Error?
What is testing of a program? Why do we need
to test a program? What are the different types of
test data used for testing a program?
Is it easier to detect a syntax error or a logic error
in a program? Write reasons in support of your
answer.
What is an iterative debugger? What special
features are made available by a debugger?
Differentiate between compiler and interpreter.
Write down the basic functionality of linker and
editor in the context of programming.
What are different types of program error?
Explain them in brief with example.
Describe different types of documentation
normally used for documenting software
systems.
Illustrate the steps for documenting a typical
Antivirus Software.
Unit-2
Question
No.
1
2
3
Answer
Answer: d
Answer: c
Answer: d
2
2
A
A
2
2
B
B
2
2
4
4
C
C
A
A
4
4
B
C
8
8
B
B
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Unit
3
Answer: b
Answer: a
Answer: b
Answer: a
Answer: d
Answer: c
Answer: a
color
text
Label control
TextBox control
identifier
Textbox
constant
linker
Logical
List
Q. No.
1
Questions
Types of loop control statements are:
a) For loop
b) While loop
c) Do-while loop
d) All of these
What is the output of this C code?
Max.
marks
1
Difficulty
Index
A
#include <stdio.h>
int main()
{
int x = 1;
if (x > 0)
UNIT-3
printf("inside if\n");
else if (x > 0)
printf("inside elseif\n");
}
a) inside if
b) inside elseif
c) inside if
inside elseif
d) Compile time error
What is the output of this C code?
#include <stdio.h>
int main()
{
int x = 0;
if (x == 0)
printf("true, ");
else if (x = 10)
printf("false, ");
printf("%d\n", x);
}
a) false, 0
b) true, 0
c) true, 10
d) Compile time error
_______ statement is an unconditional transfer
of control statement:
a) Goto
b) Continue
c) Switch
d) All of these
Which of the following is a relational operator?
a) AND
b) <
c) +
d) &
The__________ statement is used to transfer the
control to the end of statement block in a loop:
a) Continue
b) Break
c) Switch
d) Goto
String operation such as strcat(s, t), strcmp(s, t),
strcpy(s, t) and strlen(s) heavily rely upon.
a) Presence of NULL character
b) Presence of new-line character
c) Presence of any escape sequence
d) None of the mentioned
What is the output of this C code(When 2 is
entered)?
#include <stdio.h>
void main()
{
int ch;
printf("enter a value btw 1 to 2:");
scanf("%d", &ch);
switch (ch)
{
case 1:
printf("1\n");
break;
printf("hi");
default:
printf("2\n");
}
}
10
11
12
13
14
15
16
17
18
19
20
21
22
23
a) 1
b) hi 2
c) Run time error
d) 2
The correct syntax for running two variable for
loop simultaneously is.
a) for (i = 0; i < n; i++) for (j = 0; j < n; j
+= 5)
b) for (i = 0, j = 0;i < n, j < n; i++, j += 5)
c) for (i = 0; i < n;i++){}
for (j = 0; j < n; j+= 5){}
d) None of the mentioned
The following code for (;;) represents an
infinite loop. It can be terminated by.
a) break
b) exit(0)
c) abort()
d) All of the mentioned
A ________ is 4 bytes wide, whereas a
__________is 8 bytes wide.
The
constant
6.68L
represents
a
_______________ constant.
A _________ statement is generally best to use
when you have more than two conditional
expressions based on a single variable of
numeric type.
The compiler converts your C/C++ instructions
into __________.
To expose a data member to the program, you
must declare the data member in the _____
section of the class.
The output of the following expression
3>6&&7>4 will be _______________.
In C, input/output function prototypes and
macros are defined in ____________ header file.
The command used to round off a value from
1.66 to 2.0 is ___________.
The default data type in MATLAB is
____________.
Size of short integer and long integer can be
verified using the ______________ operator.
Using loops print numbers between 100 and 999,
using C code.
Write a program in C to find the area and
perimeter of a circle.
Write a C program to count number of character
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
in a string.
Write a program in C to reverse a number check
whether the number is palindrome or not.
Write a program in C to check whether a given
number is prime or not.
Write a program in C to input a name and reverse
it and check whether the string is Palindrome or
not.
Write a program in C to print the numbers from 4
to 9 and their squares.
Write a C program to count number of character
in a string.
What are the different types of control statements
available in 'C'? Explain with an example
Write a loop that will calculate sum of every
third integer, beginning with i=2 for all values of
i that are less than 100. Write the loop in
two different ways:
i. Using a do-while statement.
ii. Using a for statement.
What are the conditional statements? When it is
needed and how it can be used in programming?
Write a program in C for swapping two elements
using third variable.
Write the syntax for scanf and printf functions of
C assuming the variable under consideration is a
character.
Write a program in C to find the number of
vowels in a given string.
Write a program in C to input a three digit
number and check whether the number is an
Armstrong Number or not.
Ex: 153= 13+53+33= 1+125+27.
Explain the two way selection (if, if-else, nested
if-else, cascaded if-else) in C language with
syntax.
A C program contains the following declaration.
static int x[8] = {10, 20, 30, 40, 50, 60, 70, 80};
i. What is the meaning of x?
ii. What is the meaning of (x+2)?
iii. What is the value of *x?
iv.
What is the value of (*x+2)?
v.
What is the value of *(x+2)?
Write a program in C to find sum of given series
by using function with argument and return
value: e = 2 + 3/1! 6/2! + 9/3! 12/4! !
Differentiate between local and global variable.
Write a C program to illustrate the effect of
40
Unit-3
Question
No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Answer
16
17
18
19
20
false
stdio.h
ceil()
double
sizeof()
Answer: d
Answer: a
Answer: b
Answer: a
Answer: b
Answer: b
Answer: a
Answer: d
Answer: b
Answer: a
float, double
long double
switch
object code
public
Unit
4
Q. No.
1
Questions
What is the output of this C code?
Max.
marks
1
Difficulty
Index
A
1. #include <stdio.h>
2.
int main()
3.
4.
5.
6.
return 0;
7.
a) hello
b) ello
c) hi
d) ello hi
Advantage of a multi-dimension array over pointer 1
array.
a) Pre-defined size.
b) Input can be taken from user.
c) Faster Access.
d) All of the mentioned
Which of the following operation is possible using a 1
pointer char?
(Assuming declaration char *a;)
a) Input via %s
b) Generation of multidimensional array
c) Changing address to point at another location
d) All of the mentioned
What is the output of this C-code?
1
UNIT-4
1. #include <stdio.h>
2.
void main()
3.
4.
5.
int *p = a;
6.
7.
printf("%p\t%p", p, a);
}
1. #include <stdio.h>
2.
void main()
3.
4.
5.
char *p = s;
6.
7.
2
2
A
B
int i,j:
int ctr = 0;
int myArray[2][3];
for(i=0;i<3;i++)
for(j=0;j<2;j++)
{
myArray[j][i]=ctr;
ctr++;
}
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
2
2
A
A
B
2
4
C
A
36
37
38
39
40
Unit-4
Question
No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Answer
Answer: c
Answer: d
Answer: c
Answer: a
Answer: c
Answer: d
Answer: a
Answer: d
Answer: b
Answer: b
NULL or \0
derived
external, static
datatype nameofarray [size];
n-1
Garbage Value
base address
sequential
initialization
0(Zero)
Unit
5
Q. No.
1
Questions
Max.
marks
1
Difficulty
Index
A
UNIT-5
d) scanf()
Header files in C contain
1
a) Compiler commands
b) Library functions
c) Header information of C programs
d) Operators for files
It is necessary to declare the type of a function in 1
the calling program if the function
a) Returns an integer
b) Returns a non-integer value
c) Is not defined in the same file
d) None of these
What will be the value retuned by the following 1
function, when it is called with a value 11?
recur(int num)
if ( ( num/2) !=0 )
return ( recur(num/2 ) * 10+num%2 );
else return 1;
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
2
2
2
B
B
C
4
4
4
4
A
A
B
B
40
of Tower-of-Hanoi.
Write a C program to calculate XY using 8
recursion where values of X and Y are entered
through keyboard. Don't use pow() function.
Unit-5
Question
No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Answer
Answer: d
Answer: d
Answer: a
Answer: b
Answer: a
Answer: a
Answer: b
Answer: b
Answer: c
Answer: c
local
void
variable function
fprintf
0 or 1
Call-by-value
Functions
macro
Recursive
initialised