0% found this document useful (0 votes)
163 views

A Introduction To Computing Questions For 2016 Exit Exam

Uploaded by

ousmi2741
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
163 views

A Introduction To Computing Questions For 2016 Exit Exam

Uploaded by

ousmi2741
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Mizan Tepi University

College of Engineering and Technology

Introduction to computing Exit exam model questions


1. Who invented C++?
a) Dennis Ritchie b) Ken Thompson c) Brian Kernighan d) Bjarne Stroustrup
2. What is C++?
a) C++ is an object-oriented programming language
b) C++ is a procedural programming language
c) C++ supports both procedural and object-oriented programming language
d) C++ is a functional programming language

3. Which of the following is the correct syntax of including a user defined header files in C++?
a) #include [userdefined] b) #include “userdefined”
c) #include <userdefined.h> d) #include <userdefined>

4. Which of the following is used for comments in C++?


a) /* comment */ b) // comment */
c) // comment d) both // comment or /* comment */

5. Which of the following user-defined header file extension used in c++?


a) hg b) cpp c) h d) hf

6. Which of the following is a correct identifier in C++?


a) VAR_1234 b) %var_name c) &VARNAME d) 7var_name

7. What is the output of the following program

#include <iostream.h>
int main () {
}
A) syntax error B) No or empty output C) logical error D) A and C
8. What is the output of the following program

#include <iostream>
using namespace std;
int g = 20;
int main () {
int g = 10;
cout << g;
return 0;
}
A) syntax error B) 20 C) 10 D) 30

Prepared by: Mekuanint Erkie 2016 E.C


9. What happens if the following program is executed in C++?

#include <iostream.h>
void func(void)
{
Cout<<"Hello";
}
int main()
{
func();
func(2);
}

a) Outputs Hello twice b) Error in execution in C++


c) no output d) Outputs Hello once

10. Find the output of the following code:


#include <iostream>
using namespace std;
int main()
{
double a = 2.5;
int b = 3;
b = a;
cout << b<<”,”<<a;
}
a) 2, 2 b) 2.5, 3 c) 2, 2.5 d) 3, 2.5

11. Which of the following type is provided by C++ but not C?


a) double b) float c) int d) bool

12. What is the value of p in the following C++ code snippet?

#include <iostream>
using namespace std;
int main()
{
int p;
bool a = true;
bool b = false;
int x = 10;
int y = 5;
p = ((x | y) + (a + b));
cout << p;
return 0;
}
a) 12 b) 0 c) 2 d) 16

Prepared by: Mekuanint Erkie 2016 E.C


13. Which of the following is not considered hardware?
a) Operating system b) CPU c) Keyboard d) Hard disk
14. What will be the output of the following C++ function?

#include<iostream.h>
int main()
{
int i = 1;
int *ptr = &i;
cout <<* ptr;
return 0;
}
a) Runtime error may be possible c) 1
b) Compiler error may be possible d) 0

15. Which of the following correctly declares an array in C++?


a) array{10}; b) array array[10]; c) int array; d) int array[10];

16. A _______ is a memory variable that stores memory address.


A. pointer B. array C. inheritance D. none
17. what is the output of the following program

#include <iostream>
using namespace std;
int main( )
{
***** const char *a = "Hello\0World";
cout<<a;
return 0;
}

a) Hello b) World c) Error d) Hello World

18. Which of the following is used to terminate the function declaration in C++?
a) ; b) ] c) ) d) :

19. What will be the output of the following C++ code?

#include <iostream>
using namespace std;
int main()
{
char c = 74;
cout << c;
return 0;
}
a) I b) J c) A d) N

Prepared by: Mekuanint Erkie 2016 E.C


20. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{ char x = 'J';
int y = 72;

if(x > y)
{
cout << "x is greater";
}
else
{
cout << "y is greater";
} }
A. x is greater B. y is greater C. Compiler error D. x is greater y is greater
21. Which of the following symbol is used to declare the preprocessor directives in C++?
a) $ b) ^ c) # d) *
22. What is Inheritance in C++?
a) Deriving new classes from existing classes
b) Overloading of classes
c) Classes with same names
d) Wrapping of data into a single class
23. What is meant by a polymorphism in C++?
a) class having only single form b) class having four forms
c) class having many forms d) class having two forms
24._______________loop will be executed at least once even if the condition is false initially
A.do-while B.while C.for D.none
25. What will be the output of the following C++ code?

#include <iostream>
using namespace std;
int main ()
{
int a, b, c;
a = 2;
b = 7;
c = (a > b) ? a : b;
cout << c;
return 0;
}
a) 9 b) 14 c) 2 d) 7

26. Which of the following is used to represent the absence of parameters?


a) int b) short c) void d) float

27. What does ‘\a’ escape code represent?


a) alert b) backslash c) tab d) new line

Prepared by: Mekuanint Erkie 2016 E.C


28. What does ‘\t’ escape code represent?
a) alert b) backslash c) tab d) new line

29. Which of the following escape sequence represents carriage return?

a) \r b) \n c) \n\r d) \c

\r is used to represent carriage return which means move the cursor to the beginning of the next line.

30. In C++ “<<endl;” is the same function as:

a) \a b) \t c) \n d) \v

31. Which type is best suited to represent the logical values?


a) integer b) Boolean c) character d) float

32. The value pi=3.14 can be represented using which data type?
a) double b) void c) int d) bool

33. Which of the following is called extraction /get from operator?

A) < B) << C) > D) >>

34. Which of the following is called address operator?

- B) * C) % D) &

35. What will be the output of the following C++ code?

#include <iostream>
using namespace std;
int square (int *x, int *y)
{
*x = (*x) * --(*y);
}
int main ( )
{
int number = 3;
square(&number, &number);
cout << number;
return 0;
}
a) 3 b) Error c) 9 d) 6

36. Which is more effective while calling the C++ functions?

a) call by object b) call by pointer c) call by value d) call by reference

Prepared by: Mekuanint Erkie 2016 E.C


37. Choose the best option.

1. extern int i;
2. int i;
a) both 1 and 2 declare i
b) 1 declares the variable i and 2 defines i
c) 1 declares and defines i, 2 declares i
d) 1 declares i,2 declares and defines i

38. What will be the output of the following C++ code?


#include <iostream>
using namespace std;
int g = 100;
int main()
{
int a;
{
int b;
b = 20;
a = 35;
g = 65;
cout << b<<"," << a<<","<< g<<"," ;
}
a = 50;
cout << a<<"," << g;
return 0;
}
a) 20,35,65,50,65 b) 20,35,65,50,35 c) 20,35,65,50,100 d) 20,35,65,20,65

39. What will be the output of the following C++ code?


#include <iostream>
using namespace std;
int main()
{
int a = 10;
if (a < 10)
{
for (int i = 0; i < 10; i++)
cout << i;
}
else
{
cout << i;
}
return 0;
}
a) 0123456789 b) 123456789 c) 0 d) error

Prepared by: Mekuanint Erkie 2016 E.C


40. what will be the output of the following c++ code fragment
int main()
{
int x;
cout<<x;
}
A. Error B. 0 C. empty output D. none

41. What will be the output of the following C++ code?


#include <iostream>
using namespace std;
int main()
{
int x = -1;
unsigned int y = 2;
if(x > y)
{
cout << "x is greater";
}
else
{
cout << "y is greater";
} }
a) x is greater b) y is greater c) error d) no output

42. What will be the output of the following C++ code?


#include <iostream>
using namespace std;
int main()
{
int a = 8;
int y= a&&true;
cout << "ANDing integer 'a' with 'true' :" << y;
return 0;
}
a) ANDing integer ‘a’ with ‘true’ :8 b) ANDing integer ‘a’ with ‘true’ :0
c) ANDing integer ‘a’ with ‘true’ :1 d) ANDing integer ‘a’ with ‘true’ :9

43. What will be the output of the following C++ code?


#include <iostream>
using namespace std;
int main()
{
int i = 3;
int l = i / -2;
int k = i % -2;
cout << l << k;
return 0;
}
a) compile time error b) -1 1 c) 1 -1 d) syntax error
Prepared by: Mekuanint Erkie 2016 E.C
44. How many characters are specified in the ASCII scheme?
a) 64 b) 128 c) 256 d) 24

45. What is the output of the f/f

#include <iostream>
using namespace std;
int main()
{
int i = 3;
char k='a';
cout << i+ k;
return 0;
}
A) 0 B) 3 C) 100 D) 68 E) Error

46. Which of the following will not return a value?


a) null b) void c) empty d) free

47. What will be the output of the following C++ code?

#include <iostream>
using namespace std;
int main()
{
void a = 10, b = 10;
int c = a + b;
cout << c;
return 0;
}
a) 20 b) logical error c) syntax error d) 40

48. Choose the right option.

string* x, y;

a) x is a pointer to a string, y is a string


b) y is a pointer to a string, x is a string
c) both x and y are pointers to string types
d) y is a pointer to a string

49. Which one of the following is not a possible state for a pointer.
a) hold the address of the specific object c) zero
b) point one past the end of an object d) point to a type

Prepared by: Mekuanint Erkie 2016 E.C


50. What will be the output of the following C++ code?

1. #include <iostream>
2. using namespace std;
3. int main()
4. {
5. int a = 5, b = 10, c = 15;
6. int *arr[ ] = {&a, &b, &c};
7. cout << arr[1];
8. return 0;
9. }
a) 5 b) 10 c) 15 d) it will return some hexa-decimal random number

51. What will be the output of the following C++ code?

1. #include <iostream>
2. using namespace std;
3. int main()
4. {
5. char *ptr;
6. char Str[] = "abcdefg";
7. ptr = Str;
8. ptr += 2;
9. cout << ptr;
10. return 0;
11. }
a) fg b) cdefg c) defg d) abcd e) abcdefg

52. The constants are also called as _____________


a) const b) preprocessor c) literals d) variables

53. What are the parts of the literal constants?


a) integer numerals b) floating-point numerals
c) strings and boolean values d) all of the mentioned

54. How are the constants declared?


a) const keyword b) #define preprocessor
c) both const keyword and #define preprocessor d) $define

55. What will be the output of the following C++ code?

#include <iostream>
using namespace std;
int main()
{
int const p = 5;
cout << ++p;
return 0;
}
a) 5 b) 6 c) Error d) 8
Prepared by: Mekuanint Erkie 2016 E.C
56. Which of the following statement is not true about preprocessor directives?
a) These are lines read and processed by the preprocessor
b) They do not produce any code by themselves
c) These must be written on their own line
d) They end with a semicolon

57. Regarding the following statement which of the statements is true?

const int a = 100;

a) Declares a variable a with 100 as its initial value


b) Declares a construction a with 100 as its initial value
c) Declares a constant a whose value will be 100
d) Constructs an integer type variable with a as identifier and 100 as the value

58. The difference between x and ‘x’ is?


a) The first one refers to a variable whose identifier is x and the second one refers to the character
constant x
b) The first one is a character constant x and the second one is the string literal x
c) Both are same
d) Both are string literal

59. What is the only function all C++ programs must contain?

A) start() B) system() C) main() D) program()

60. C++ programs start their execution at ................

(A) start() (B) begin() (C) main() (D) output()

61. What punctuation is used to signal the beginning and end of code blocks?

A) { } B) -> and <- C) BEGIN and END D) ( and)

62. which of the following operator can be used to calculate the value of one number raised to another.

A) ^ B) ** C) ^^ D) no operator

63. Which data type can be used to hold a wide character in C++?

A) unsigned char; B) int C) wchar_t D) none

64. Which of the following can be valid identifier in c++

A) true B) false C) friend D) none

65. Which of the following is the correct operator to compare two variables?

A) := B) = C) equal D) ==

Prepared by: Mekuanint Erkie 2016 E.C


66. Which of the following is the boolean operator for logical-and?

A) & B) && C) | D) |&

67. What is the output of the following program?


#include <iostream>
using namespace std;
int x=2;
int main () {
int x = 1;
switch(x) {
case 1 :
cout << "Hi!" << endl;
break;
default :
cout << "Hello!" << endl;
}
}
A ) Hello B) Hi C) HiHello D) Compile error
68. What is the output of the following program?
#include <iostream>
using namespace std;
int x=2;
int main () {
int x = 1;
switch(x) {
case 1 :
cout << "Hi";
default :
cout << "Hello" << endl;
}
}
A ) Hello B) Hi C) HiHello D) Compile error

69. Evaluate !(1 && !(0 || 1)).

A) 1 B) 0 C) Un evaluable D) None

70. Pick out the compound assignment statement.

a) a = a – 5 b) a = a / b c) a -= 5 d) a = a + 5

Prepared by: Mekuanint Erkie 2016 E.C


71 By default, all the files in C++ are opened in _________ mode.
a) Binary b) VTC c) Text d) ISCII
72. Which of the following is false?

A) Cout represents the standard output stream in c++

B) Cout is declared in the iostream standard file

C) Cout is declared within the std namespace

D) None of above

73. A variable is/are _________ .

A) String that varies during program execution

B) A portion of memory to store a determined value

C) Those numbers that are frequently required in programs

D) None of these

74. If there is more than one statement in the block of a for loop, which of the following must be
placed at the beginning and ending of the loop block?

a) parentheses( ) b) braces { } c) brackets [ ] d) arrows < >

75. Which of the following cannot be used as identifiers?

A) Letters B) Digits C) Underscores D) Spaces

76. which of the following statement allows us to make a decision from the number of choices?
a) for b) while c) switch d) go to
77. The destination statement for the goto label is identified by what label?

a) $ b) @ c) * d) :

78. More than one function had to access data ___ variables were used.

a) Local b) Automatic C) Global d) Static

Prepared by: Mekuanint Erkie 2016 E.C


79. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main() {
int n ;
for (n = 5; n > 0; n--)
{
if (n == 3)
continue;
cout << n;
}
return 0;
}
a) 543 b) 5432 c) 54321 d) 5421

80. What will be the output of the following C++ code?


#include <iostream>
using namespace std;
int main() {
int n = 15;
for (; ;)
cout << n;
return 0;
}
a) error b) 15 c) infinite times of printing 15 d) none of the mentioned

81. What will be the output of the following C++ code?


#include <iostream>
using namespace std;

int main() {
int i ;
for (i = 0; i < 10; i++);
{
cout << i;
}
return 0;
}
a) 0123456789 b) 10 c) 012345678910 d) compile time error e) 0

82. The break statement causes an exit

a) from the innermost loop only. b) from the innermost switch only.

c) from all loops & switches. d) from the innermost loop or switch.

Prepared by: Mekuanint Erkie 2016 E.C


83. The if...else statement can be replaced by which operator?

a) Bitwise operator b) Conditional operator c) Multiplicative operator d) Addition operator

84. The switch statement is also called as?

a) choosing structure b) selective structure c) certain structure d) bitwise structure

85. Choose a correct C++ for loop syntax.

a) for(initialization; condition; inc /dec){ // statements };

b) for(declaration; condition; increment operation){ // statements };

c) for(declaration; increment operation; condition){ // statements };

d) for(condition; initialization; inc/dec){ // statements };

86. Choose a correct C++ do while syntax.

a) dowhile(condition){ // statements }; b) do while(condition){ // statements };

c) do{ // statements }while(condition) d) do{ // statements }while(condition);

87. Choose a correct C++ Statement.

a) a++ is (a= a+1) POST INCREMENT operator

b) a-- is (a = a-1) POST DECREMENT operator and --a is (a = a-1) PRE DECREMENT operator

c) ++a is (a = a+1) PRE INCREMENT operator

d) All of the above.

88. Which of the following is an entry-controlled loop?

a) For loop b) while loop c) do-while loop d) both a & b

89. Which of the following is an exit-controlled loop?

a) While loop b) For loop c) Do while loop d) both a & b

90. Decision Control statements in C++ can be implemented using

a) if b) if-else c) Conditional Operator d) All of the above

91. if you have to make decision based on multiple choices, which of the following is best suited?

a) if b) if-else c) if-else-if d) All of the above

Prepared by: Mekuanint Erkie 2016 E.C


92. What will be the output of the following C++ code?

#include <iostream>
using namespace std;
int main() {
if (0) {
cout << "Hello" ;
}
else
{
cout << "Good Bye" ;
}
return 0;
}
a) Hello b) Good Bye c) HelloGood bye d) Compilation Error

93. Which of the following identifiers is invalid?


A) papername B) writername C) typename D) printname

94. In situations where we need to execute body of the loop before testing the condition, we should
use_____.

a) For loop b) while loop c) do-while loop d) nested for loop

95. Loops in C++ Language are implemented using?

a) While loop b) For loop c) Do while loop d) All of the above

96. Which of the following for loop is not correct?


A) for(;x<10;) B) for(; ; ;) C) for(; ;) D) for (x=0;x!=1;) E) all except B

97. The index number an array starts with __ and the last index number of an array of size n will be_

a) 0, n-1 b) 1,n c) 0, n+1 d) 0,n


98. What is the index number of the last element of an array with 9 elements?

a) 9 b) 8 c) 10 d) some random number

99. Which of the following accesses the seventh element stored in array?

a) array[6]; b) array[7]; c) array(7); d) array(6);

100. What will happen in the following C++ code snippet?


int a =100, b =200;
int *p = &a, *q = &b ;
p=q
a) b is assigned to a b) p now points to b
c) a is assigned to b d) q now points to a

Prepared by: Mekuanint Erkie 2016 E.C


101. Which of the following correctly initialize a character?
a) char a=”A”; b) char a= A; c) char a={A}; d) char a= ‘A';

102. Find the output of the following code:


#include <iostream>
using namespace std;
int main(){
int x = 1, y = 2;
switch(y){
case 1: cout << "one";
case 2: cout << "two";
default: cout << "three";
}}
a) onetwo b) one c) onetwothree d) twothree

103. What will be the output of the following C++ code?


#include <iostream>
using namespace std;
int array1[] = {1, 2, 3, 4, 5};
int array2[] = {6, 7, 8, 9, 10};
int temp, result = 0;
int main() {
for (temp = 0; temp < 5; temp++){
result += array1[temp];
}
for (temp = 0; temp < 4; temp++){
result += array2[temp];
}
cout << result;
return 0;
}
a) 45 b) 65 c) 55 d) 15 e) 40

104. What will be the output of the following C++ code?

#include <iostream>
using namespace std;
int main() {
int array[] = {0, 2, 4, 6, 7, 5, 3};
int n, result = 0;
for (n = 0; n < 7; n++){
result += array[n];
}
cout << result;
return 0;
}
a) 7 b) 21 c) 27 d) 3

Prepared by: Mekuanint Erkie 2016 E.C


105. let us say you are write a C++ programs which calculate the sum of two numbers. When the program
execution starts
A. start() B. begin() C. main() D. output()
106. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main() {
int a = 5, b = 10, c = 1;
int *arr[3] = {&a, &b, &c};
cout << *arr[2];
return 0;
}
a) 5 b) 10 c) 1 d) some hex decimal value

107. What will be the output of the following C++ code?

#include <iostream>
using namespace std;
int main() {
char str[5] = "ABC";
cout << str [3];
cout << str;
return 0;
}
a) ABC b) ABCD c) AB d) AC

108. What will be the output of the following C++ code?


#include <iostream>
using namespace std;
int main() {
char str[5] = "ABC";
cout << str [1];
cout << str;
return 0;
}
a) ABC b) ABCD c) BC d) BABC

109. _______ is a collection of elements of similar data types in which each element is unique and located
in separate memory location.
A. pointer B. array C. attributes D. none
110. The data elements in the structure are also known as what?
a) objects b) members c) data d) objects & data

111. What will be used when terminating a structure?


a) : b) } c) ; d) ;;

112. The declaration of the structure is also called as?


a) structure creator b) structure signifier c) structure specifier d) structure creator & signifier

Prepared by: Mekuanint Erkie 2016 E.C


113. Which of the following is a properly defined structure?

a) struct {int a;} b) struct a_struct {int a;} c) struct a_struct int a; d) struct a_struct {int a;};

114. What will be the output of the following C++ code?

#include <iostream>
#include <string.h>
using namespace std;
struct student{
int num;
char name[25];
};
int main() {
student stu;
stu.num = 123;
strcpy(stu.name, "john");
cout << stu.num <<"," ;
cout << stu.name << endl;
return 0;
}
a) 123,john b) john,john c) 123 d) runtime error

115. Which of the following accesses a variable in structure *b?


a) b->var; b) b.var; c) b-var; d) b>var;
116. What is the effect of writing a break statement inside a loop?
a) It cancels remaining iterations. b) It skips a particular iteration.
c) The program terminates immediately. d) Loop counter is reset.
117. In an assignment statement ____________.
A) The lvalue must always be a variable
B) The rvalue might be a constant, a variable, an expression or any combination of these
C) The assignment always takes place from right to left and never the other way
D) All of above
118. What will be the output of the following C++ code?

#include <iostream>
using namespace std;
int a=10;
int main(){
int a=20;
cout<<a<<”,”<<::a;
}
A) Syntax error B) 10, 20 C) 20,20 D) 20, 10 E) 10,10

Prepared by: Mekuanint Erkie 2016 E.C


119. Find the output of the following code:
#include<iostream>
using namespace std;
int main() {
int x = 10;
cout << -- x + 1<<",";
cout<< x++;
}
a) 10, 9 b) 10, 10 c) 9, 10 d) 9, 9 e) 10,11

120. Find the output of the following code:


#include <iostream>
using namespace std;
int main()
{
double a = 2.5;
int b = 3;
b = a;
cout << b+a;
}
a) 2 b) 4 c) 5 d) 4.5 e) 5.5

121. Which of the following best describes an array?


a) A data structure that shows a hierarchical behavior b) Container of objects of similar types
c) Container of objects of mixed types d) All of the mentioned
122. How do you initialize an array in C++?
a) int arr[3] = (1,2,3); b) int arr(3) = {1,2,3}; c) int arr[3] = {1,2,3}; d) int arr(3) = (1,2,3);

123. What are the advantages of arrays?


a) Easier to store elements of same data type
b) Used to implement other data structures like stack and queue
c) Convenient way to represent matrices as a 2D array
d) All of the mentioned
124. Assuming int is of 4 bytes, what is the size of int arr[15];?
a) 15 b) 19 c) 11 d) 60
125. How many elements an array of int x[10][20][30]; store?
a) 30 b) 200 c) 6000 d) 60
126. C++ runs on ?
A. Windows B. MacOS C. UNIX D. All of the above
127. How structures and classes in C++ differ?
a) In Structures, members are public by default whereas, in Classes, they are private by default
b) In Structures, members are private by default whereas, in Classes, they are public by default
c) Structures by default hide every member whereas classes do not
d) Structures cannot have private members whereas classes can have
128. Which of the following gives the value stored at the address pointed to by the pointer a?
A) a; B) val(a); C) *a; D) &a;

Prepared by: Mekuanint Erkie 2016 E.C


129. find the output of the following c++ code
#include <iostream>
using namespace std;
int main() {
int space, rows;
for(int i = 1, k = 0; i <= 3; ++i, k = 0) {
for(space = 1; space <= 3-i; ++space) {
cout <<" ";
}
while(k != 2*i-1) {
cout << "* ";
++k;
}
cout << endl;
}
return 0;
}

A) B) C) D)

130. Consider the following statements:


int x = 6, y=8, z;
y = x++;
z = ++x;
The value of x,y,z by calculating the above expressions are:-
A) y=8, z=8, x=6 B) y=6, x=8, z=8 C) y=9, z=7, x=8 D) y=7, x=8, z=7
131. Which of the following is the correct operator to assign a value for a variable?
A) := B) = C) equal D) ==
132. Which of the following is the boolean operator for bitwise-or?
A) & B) && C) | D) ||

133. Which of the following is C++ equivalent for printf()?


a) cin b) cout c) print d) input
134. The switch expression must be of type .................. or .................
A) char,float B) float,int C) int, char D) char, float
135. Which of the following explains Polymorphism?

a) int func(int, int); b) int func(int); c) int func(float); d) int func();


float func1(float, float); int func(int); float func(int, char); int new_func();

Prepared by: Mekuanint Erkie 2016 E.C


136. Which of the following is the correct way to declare a pointer?
A. int *ptr B. int ptr C. int &ptr D. All of the above

137. In a group of nested loops, which loop is executed the greatest number of times?
(A) The outermost loop. (B) The innermost loop.

(C) All loops are executed the same number of times.

(D) Cannot be determined without knowing the size of the loops bottom of form.

138. when you rectified all the syntax errors and the compiler produced an equivalent machine code of
your program but the result of program is not as desired. What type of error is happened?
a) syntax error b) logical error c) run time error d) compilation error

139. In which part of the for loop termination condition is checked?

for(I;II;III)

{IV}

a) I b) II c) III d) IV

140. Find the output of the following code:


#include <iostream>
using namespace std;
int main()
{
int x = 1, y = 2;
cout << x - y + 3 * 4 / 5;
}
a) 3 b) 2 c) 1 d) 2.5 e) 3.2

141. Which of the following is used to translate every single line command of high-level language code to
its equivalent machine language code?
a) Assembler b) compiler c) interpreter d) b and c
142. find the output of the following c++ code:
#include <iostream>
using namespace std;
int main() {
int x=(7%2-1)?-2:2;
cout<<x;
return 0;
}
a) 2 b) -2 c) un evaluable d) 0

143. ___ is a Program representation of some real-world thing.


a) Object b) Class c) Attributes d) Function

Prepared by: Mekuanint Erkie 2016 E.C


144. ___ is a header file used in C++ that handles input and output functions.
a) stdio.h b) iostream.h c) conio.h d) string.h

145. Which of the following is a not property of algorithm

a) Algorithm must complete after a finite number of steps

b) Each step must be clearly defined

c) It is not must to solve the problem completely.

d) It must solve with the least amount of computational resources

146. which one completely takes you out of the program C++?

a) continue; statement b) break; statement c) exit; statement d) all

147. Which operator checks if the values of two operands are equal or not, if values are not equal then
condition becomes true?

A) >= B) <= C) != D) >


148. In Passing the argument by ___ no copy of the variable is created.
a) value b) reference c) both d) none
149. A pointer can be initialized with
A. Null B. Zero C. Address of an object of same type D. All of the above
150. Which of the following is known as the language made up of binary-coded instructions?
a) High level b) BASIC c) C d) Machine
151. Terminal Symbol in a flowchart indicates
a) end b) processing c) input output d) decision
152. which of the following program planning tool allows the programmers to plane program logic by
writing program instruction in an ordinary language?
a) flowchart b) pseudo code c) program d) looping

153. the main module of a program contains the following sequence of statements call module A ___ call
module B ___ call module C ___ call module D ___ . Which of the following statement is executed after
call module B?
a) call module A b) call module C c) call module D d) first statement in module B

154. Which of the following statement is executed after all statements in call module B have been carried
out in above question 153?
a) call module A b) call module C c) call module D d) first statement in module C
155. An algorithm represented in the form of programming language is__________
a) flowchart b) pseudo code c) program d) none of the above
Prepared by: Mekuanint Erkie 2016 E.C
156. which of the following is a pictorial representation of an algorithm?
a) flowchart b) pseudo code c) program d) none of the above
157. which of the following symbol in a flowchart are used to indicate all arithmetic processes of adding,
multiplying, subtracting and dividing?
a) Rhombus b) Rectangle c) terminal d) parallelogram
158. After a programmer plans the logic of a program, she /he will next__________
a) understand the problem b) translate the program c) code the program d) test the program
159. Consider the following pseudo code and determine which structure is?
Get number, get another number, if the first number is greater than second number print the first number
Else print the second number.
a) Sequence b) loop c) decision d) nested
160. Consider the following pseudo code and determine which structure is?
Get number, get another number, multiply numbers and print the result.
a) Sequence b) loop c) decision d) nested
161. which of the following enhances the versatility of the computer to perform a set of instructions
repeatedly?
a) loop b) function c) header files d) statement
162. What is this operator called ?:
A. conditional B. relational C. casting operator D. unrelational
163. What is the difference between a flowchart and pseudocode?
a) Flowchart is diagrammatic whilst pseudo code is written in a programming language
b) flowchart is textual but pseudo code is diagrammatic
c) flowchart is a diagrammatic description of an algorithm whilst pseudo code is a textual description
of an algorithm
d) flowchart and pseudo code are the same thing
164. A flowchart needs to represent a situation where for each mark a MTU student is award
'Pass' or 'Fail' in exit exam...the system will consider the mark and if it's 50 or over award
'Pass', else it awards 'Fail'. This is an example of which of the algorithm constructs?
a) Decision b) Loop c) Sequence d) All of the above
165. When can algorithms be used?
a) Only with computers b) Only when programming
c) Only with flowcharts d) Any time to design solutions to problems
166. Which of the following is the smallest unit of data in a computer?
a) Bit b) KB c) Nibble d) Byte
Prepared by: Mekuanint Erkie 2016 E.C
167. Which of the following language does the computer understand?

a) Computer understands only C Language

b) Computer understands only Assembly Language

c) Computer understands only Binary Language

d) Computer understands only BASIC

168. Which of the following is the brain of the computer?

a) Central Processing Unit b) Memory c) Arithmetic and Logic unit d) Control unit

169. Which of the following is the correct definition of Computer?

a) Computer is a machine or device that can be programmed to perform arithmetical or logic


operation sequences

b) Computer understands only binary language which is written in the form of 0s & 1s

c) Computer is a programmable electronic device that stores, retrieves, and processes the data

d) All of the mentioned

170. Which of the following unit is responsible for converting the data received from the user into a
computer understandable format?

a) Output Unit b) Input Unit c) Memory Unit d) Arithmetic & Logic Unit

171. Which of the following is designed to control the operations of a computer?

a) User b) Application Software c) System Software d) Utility Software

172. Which of the following are physical devices of a computer?

a) Hardware b) Software c) System Software d) Package

173. Which of the following is Binary Left Shift Operator?


A. >> B. << C. || D. $$

174. Which of the following devices provides the communication between a computer and the outer
world

a) Compact b) I/O c) Drivers d) Storage

175. Which of the following is the device used for converting maps, pictures, and drawings into
digital form for storage in computers?

a) Image Scanner b) Digitizer c) Printer d) Scanner


Prepared by: Mekuanint Erkie 2016 E.C
176. Which part of the computer shows you information from the computer?

A. Mouse B. Keyboard C. Camera D. Monitor E. All of the above

177. Which computer parts give you sound from the computer?

A. Speakers B. Mouse C. Laptop D. microphone

178. A ______ is used to make a copy of a picture or document.

A. Speaker B. Scanner C. Monitor D. CPU

179. Which of the following programs enables you to calculate numbers related to rows and
columns?

a) Window program b) Spreadsheet program c) Graphics program d) Word program

180. The central processing unit is located in the _____.

a) Hard disk b) System unit c) Memory unit d) Monitor

181. What is the mean of the Booting in the system?

a) Restarting computer b) Install the program c) To scan d) To turn off

182. A projector is an _ _ _ _ _ _ device that can take images generated by a computer and reproduce
them on a large, flat surface.

(a) input (b) output (c) input and output (d) monitor input

183. The number of function keys in a keyboard is

(a) 14 (b) 12 (c) 13 (d) 15

184. Christian has created a story of ten pages, but only wants to print the first two pages. Which
printer command should he choose?

a) Print all b) Print from 1 to 2 c) Page setup d) Print Preview

185. What are the main components of a computer system?

a) CPU, CD-ROM, Mouse, Keyboard, Sound card

b) Memory, Video card, Monitor, Software, Hardware

c) Modem, Keyboard, Word Processor, Printer, Screen

d) CPU, Memory, System bus, Input, Output

Prepared by: Mekuanint Erkie 2016 E.C


186. Find the output of the following code:

int main () {
int x = 10;
x=x^2;
cout <<x;
}
A. 100 B. 12 C. 8 D. 20

187. Find the output of the following code:

int main () {
cout <<3/2;
}
A. 1.5 B. 1 C. Error D. 0

188. Find the output of the following code:

int main () {
cout <<3/2.0;
}
A. 1.5 B. 1 C. Error D. 0

189. Find the output of the following code:

int main () {
cout <<-3%2;
}
A. -1 B. 1 C. Error D. 0

190. Find the output of the following code:


int main () {
cout <<3%-2;
}
A. -1 B. 1 C. Error D. 0

191. Find the output of the following code:


int main () {
cout <<3%2.0;
}
A. -1 B. 1 C. Error D. 0

192. Find the output of the following code fragment:


if (0 )
cout << “Hmmmm ”;
else
cout << “Ok”;
A. Hmmmm B. Ok C. Error D. Hmmmm OK

Prepared by: Mekuanint Erkie 2016 E.C


193. Find the output of the following code snippet:

if (!0 )
cout << “Hmmmm ”;
else
cout << “Ok”;
A. Hmmmm B. Ok C. Error D. Hmmmm OK

194. Each pass through a loop is called a/an ...............


(A) enumeration (B) iteration (C) culmination (D) pass through

195. Find the output of the following code snippet:

int main () {
while(10)
cout <<2;
return 0;
}
A. 2 B. 10 C. Error D. Display 2 infinitely

196. Find the output of the following code snippet:

int main ()
{
for(int i=1;i<5;i++)
{
if (i%3==0)
exit(0);
cout<<i<<”,”;
}
cout<<”out”;
return 0;
}
A. 1,2,3,4,out B. 1,2,out C. 1,2,4,out D. 1,2

197. Which concept allows you to reuse the written code in C++?

a) Inheritance b) Polymorphism c) Abstraction d) Encapsulation

198. Which of the following groups consists of only output devices?


(a) Scanner, monitor, printer (b) Mouse, monitor, printer
(c) Keyboard, monitor, printer (d) Monitor, printer, plotter

199. Mouse is
a) pointing and drop device b) cursor-control device c) monitoring device d) a and b

200. Which input device is used for input text, numbers, and commands to the computer?

a) Mouse b) Keyboard c) Scanner d) All of the above


Prepared by: Mekuanint Erkie 2016 E.C

You might also like