Upload
shrinivas-dasari
View
220
Download
0
Embed Size (px)
Citation preview
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
1/21
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
2/21
C) double quotes
D) single quotes
5. ________is a place where we can store values. A) Keyword
B) Variable
C) Constant
D) function
6. Size of float data type is _________ bits.
A)6
B) 8
C) 16
D) 32
7. The ____________ of a variable determines what kinds of values it may take on.
A) location
B) name
C) data type
D) time of delcaration
8. ---------------- is a sequence of characters enclosed within double quotes.
A) string constant
B) character constant
C) integer constant
D) any of these
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
3/21
9. Operators are used in programs to manipulate ----------------.
A) data
B) variables
C) keywords
D) both A) and B)
10. The ------------------ operator gives you the remainder when two integers are divided.
A)%
B)+
C) @
E) /
11. The ++ operator is ---------------------
A) unary
B) binary
C) terneray
D) either A) or B)
12. The -------------- can be used to link the related expressions together..
A) # operator
B) comma operator
C) tild operator
D) semicolon
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
4/21
13. The size of floating point data is ----------------.
A) 32 bits
B) 16 bits
C) 8 bits
D) 4 bits
14. A double data type uses --------------- bits.
A) 8
B) 4
C) 16
D) 64
15. All keywords must be written in ---------------------
A) uppercases
B) lowercase
C) either A) or B)
D) Should start with underscore
16. Keywords are also called--------------.
A) builtin functions
B) default words
C) reserved words
D) control words
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
5/21
17. In order to stop reading the input character, you can use a value called
__________________.
A) NUlB) EOF
C) Nil
D) 1010
18. What is the output of the following program segment?
int a=97;
printf(%c, a);
A) a
B) 97
C) Error
D) A
19. To print an int argument in octal, you can use ___ format string
A)%i
B) %e
C) %c
D) %o
20. What is the output of the following statement.
pr intf( %d %o %x , 100, 100, 100);
A) 100 100 100
B) 100 100 64
C) 100 144 64
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
6/21
D) 100 144 100
21. ------------- is a unconditional control statement.
A) for
B) goto
C) switch
D) default
22. The -------------- statement requires a label in order to identify the place where the branch is
to be made.
A) for
B) switch
C) goto
D) break
23. It is a good programming practice to avoid the use of ------------------ statement.
A)switch
B) for
C) default
D) goto
24. if statement is also called ------------------ statement.
A) looping
B) exit
C) conditional control
D) unconditional control
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
7/21
25. --------------- is used in a situation where we need to execute the body of the loop before the
test is performed.
A) for loopB) goto statement
C) switch statement
D) do while loop
26. The -------------- statement is used to exit from a loop.
A) for
B) switchC) break
D) goto
27. It is a good programming practice to avoid the use of ------------------ statement.
A)switch
B) for
C) default
D) goto
28. The ------------------------- causes the control to go directly to the test-condition and then to
continue the iteration process.
A) break
B) continue
C) default
D) cont
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
8/21
29. .------------------is a self-contained program segment that carries out some specific, well-
defined task..
A) loop
B) structure
C) function
D) variable
30. Every C program contains ------------------ functions.
A) one
B) one or more
C) three
D) may be zero
31. ----------------------------are the special identifiers through which information can be passed to
the function..
A) labels
B) variables
C) constants
D) parameters
32. Each argument of a function should have-----------.
A) name
B) type
C) both name and type
D) either A) or B)
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
9/21
33. ------------------- are channels of communication within a program.
A) variables
B) structures
C) functions
D) constants
34. 2. Variable which can be recognized only within a single function is called------------------.
A) Global variable
B) Local variable
C) Extern variableD) Static variable
35. ---------------------------- refers to the persistence of a variable and its scope within the
program.
A) labels
B) recursion
C) inheritance
D) Storage class
36. Variables declared within functions are called--------- variables .
A) global
B) local
C) internal
D) inner
37. ------------------- is a collection of similar type of elements.
A) Array
B) Structure
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
10/21
C) Function
D) variable
38. What is the library function used to copy one string to another ?
A) strcpy()
B) stcopy()
C) strcopy()
D) stcp()
39. The end of the string is marked with a special character called --------------- .
A) auto
B) EOF
C) the null character
D) none of these
40. Which of these library function is used to concatenate strings.
A) strcmp
B) stcat
C) strct
D) strcat
41. There are some variables that are used in more than one function, which are called-----------variables
A) static
B) dynamic
C) local
D) global
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
11/21
42. Which of the following function is used for reading a number from a keyboard ?
A) scanf()
B) getch()
C) printf()
D) readnum()
43. Identify a valid variable name from the following list.
i. sumii. avgiii. s,umiv. averagev. 9total
A) i, iii, iv, and v onlyB) i, ii, and iv onlyC) i, and iv onlyD) ii,iii,iv and v only
44. ------------- tells the compiler the name and type of a variable you'll be using in your program.
A) initialization
B) declaration
C) definition
D) instantiation
45. Which of the following is a ternary operator ?
A) &&B) ||C) ->D) ?:
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
12/21
46. What is the value of the following arithmetic expression?
14 % 3 + 7 % 2
A) 5
B) 6
C) 3
D) 2
47. Which of the following is a valid keyword ?
A) autoB) whilC) lse
D) switched
48. If the value of X is 35.2, what is the value of A in the following expression?
A = (int)(X+0.5);
A) 35
B) 35.7
C) 35.2
D) 35.5
49. What is the output of the following program segment
char c = 'A';
int i = 97;
printf("c = %c, i = %d\n", c, i);
A) c= A , i= 97
B) c=a, i= AC) c= A , i=aD) c=97 , i=a
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
13/21
50. Which of these functions facilitate the transfer of strings between the computer and the
standard input/output devices?
A) gets()
B) puts()
C) sets()
D) both A) and B)
51. The conditional operator takes ----------- operands. A) twoB) nilC) one
D) three
Ans : D) three
52. --------------- is substitute for a long if statement.
A) else if statement
B) switch statement
C) for statement
D) default statement
53. The conditional operator does not produce ----------------.
A) result
B) lvalue
C) rvalue
D) constant
54. The conditional operator is also called------------operator .
A) ternary
B) binary
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
14/21
C) unary
D) arithmetic
55. Which of these loops is / are a entry controlled loop.
A) for loopB) while loopC) do while loopD) both A) and B)
56. Which of these loops is / are a exit controlled loop.
A) for loopB) while loop
C) do while loopD) both A) and B)57. A for loop contaions ----------------.
A) initial expression
B) update expression
C) loop condition
D) all of these
58. Identify the syntax of a for loop .
A) for(expr1; expr2; expr3)
B) for(expr1: expr2 : expr3)
C) for(expr1, expr2, expr3)
D) for(expr1 expr2 expr3);
59. In a structure the link between a member and a variable is established using the ----------operator.
A) asterikB) dotC) matrix D) seed
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
15/21
60. A___________ is a convenient tool for handling a group of logically related data items.
A) array
B) functionC) structureD) loop
61. State true or false
i. C compilers are commonly available for computers of all sizes.ii. C language was developed along with the Win dows operating system, it is strongly
associated with Windows.iii. A C program can be viewed as a group of building blocks called functions .
A) true, true, false B) true, false, true C) false, true, true D) false, true, false
62. Match the following
I. Integer 1. keywordII. float 2. Does not varyIII. static 3. 16 bitsIV. constant 4. 8 bits
A) I- 4 II-3 III-1 IV-2B) I-3 II-4 III-2 IV-1C) I-2 II-1 III-4 IV-3
D) 1-4 II-2 III-1 IV- 3
63. Match the following
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
16/21
I. ? : 1. relational operatorII. Sizeof() 2. works only on integer dataIII. == 3. compile time operatorIV. % 4. ternary operator
A) I- 4 II-3 III-1 IV-2B) I-3 II-4 III-2 IV-1C) I-2 II-1 III-4 IV-3D) 1-4 II-2 III-1 IV- 3
64. State true or false
i. A character constant is formed by enclosing the character within a pair of double quote
marks..
ii. If the operands are of different data types, the lower type is automatically converted to the
higher type before the operation proceeds.
iii. When one of the operands is real and the other is integer, the expression is called a mixed-mode arithmetic expression.
A) true , true, trueB) false, false, false
C) true, false, trueD) false, true, true
65. State true or false
i. gets() and puts() functions facilitate the transfer of strings between the computer and the
standard input/output devices.
ii. getchar() function is used to accept a single character from the keyboard and putchar()
function is used to display single character on the users screen.
iii. scanf() and printf() are the two formatted input/output functions.
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
17/21
A) true , true, trueB) false, false, falseC) true, false, trueD) false, true, true
66. Match the following
I. goto 1. defaultII. switch 2. unconditionalIII. ? : 3. conditionalIV. if 4. ternary
A) I- 4 II-3 III-1 IV-2B) I-3 II-4 III-2 IV-1
C) I-2 II-1 III-4 IV-3D) 1-4 II-2 III-1 IV- 3
67. Match the following
I. Do while 1. switchII. while 2. exit controlledIII. break 3. inital, loop condition, update expressionsIV. for 4. entry controlled
A) I- 4 II-3 III-1 IV-2B) I-3 II-4 III-2 IV-1C) I-2 II-4 III-1 IV-3D) 1-4 II-2 III-1 IV- 3
68. State true or falsei. The function main() is optional in a C program
ii. The keyword extern is optional in function prototype declarations
iii The towers of Hanoi problem is best example for recursion .
A) true , true, trueB) false, false, falseC) true, false, trueD) false, true, true
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
18/21
69. State true or false
i. The arguments that appear in function definition are called actual arguments
ii. The arguments that appear when the function is called are the formal arguments.iii. The function prototype is nothing but the function declaration.
A) true , true, trueB) false, false, trueC) true, false, trueD) false, true, true
70. State true or falsei. The scope of static variables and automatic variables is the same.
ii. By default, a static variable is initialized to zero.
iii. To make a variable as an external declaration, which is defined somewhere else,you precede it with the keyword extern .
A) true , true, trueB) false, false, falseC) true, false, trueD) false, true, true
71. State true or false
i. The variables declared in the main() function are the global variables.
ii. The global variables are more secured than the automatic variables in a program.
Iii The function prototype is nothing but the function declaration.
A) true , true, trueB) false, false, trueC) true, false, trueD) false, true, true
72. What is the output of the following program segment?
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
19/21
char str1[10];
str1= Hello, world;
printf(%s, str1);
A) Hello, worldB) =Hello, world C) Compilation errorD) Syntax error
73. State true or false
ii. All elements in the array are referred with the array name.
iii. An array name is a pointer.
iii. Arrays are not limited to type int ; you can have arrays of char or double or any
other type.
A) true , true, trueB) false, false, trueC) true, false, trueD) false, true, true
74. What is the output of the following program segment?
char str1[10];
str1=Hello, world;
printf(%s, str1);
A) Hello, worldB) =Hel lo, world C) Compilation errorD) Syntax error
75. State true or falsei. All elements in the array are referred with the array name.ii. Structure is a method for packing data of different types.
iii. The compiler allocates storage for the smallest member of the union.
A) true , true, trueB) false, false, true
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
20/21
C) true, true, falseD) false, true, true
7/21/2019 BC0034-Computer Concepts C Programming-Part-2-MQP.pdf
21/21
Answer Keys
Part - A Part - B Part - C
Q. No. Ans. Key Q. No. Ans. Key Q. No. Ans. Key Q. No. Ans. Key
1 C 21 B 41 D 61 B
2 A 22 C 42 A 62 A
3 B 23 D 43 B 63 A
4 A 24 C 44 B 64 D
5 B 25 D 45 D 65 A6 D 26 C 46 C 66 C
7 C 27 D 47 A 67 C
8 A 28 B 48 A 68 D
9 D 29 C 49 A 69 B
10 A 30 B 50 D 70 A
11 A 31 D 51 D 71 B
12 B 32 C 52 B 72 C
13 A 33 A 53 B 73 C
14 D 34 B 54 A 74 C
15 B 35 D 55 D 75 C
16 C 36 B 56 C
17 B 37 A 57 D
18 A 38 A 58 A
19 D 39 C 59 B
20 C 40 D 60 C