Programmaing Languages and Technologies

Description

Olzhas
Айдана Шырманбай
Quiz by Айдана Шырманбай, updated more than 1 year ago
Айдана Шырманбай
Created by Айдана Шырманбай over 5 years ago
422
5

Resource summary

Question 1

Question
1. Specify the types of operator
Answer
  • Logical, Bitwise, Arithmetic, Relational
  • Mathematical, Bitwise, Arithmetic, Relational
  • Assignment, Bitwise, Arithmetic, Relational
  • Logical, Bitwise, Assignment, Relational

Question 2

Question
2. Logical operators always evaluated from
Answer
  • Left to right
  • No difference
  • Not sure
  • Right to left

Question 3

Question
3. When an equation uses more than one type of operator then the order of precedence has to be established with the different types of operators:
Answer
  • Arithmetic, comparison, logical
  • Comparison, logical, arithmetic
  • Logical, arithmetic, comparison
  • Arithmetic, logical, comparison

Question 4

Question
4. Precedence for Logical Operators
Answer
  • NOT, AND, OR
  • OR, AND, NOT
  • OR, NOT, AND
  • AND, OR, NOT

Question 5

Question
5. What is an array?
Answer
  • An array is a series of elements of the different type placed in contiguous memory locations that can be individually referenced by adding an index to a unique.
  • An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by multiplying an index to a unique identifier
  • An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier
  • An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a same identifier.

Question 6

Question
6. When an array is partially initialized, the rest of its elements will automatically be set to zero
Answer
  • False
  • True
  • Nothing
  • All of them

Question 7

Question
7. The whole array can be passed to a function. However, it can't be changed by the code in that function
Answer
  • False
  • All of them
  • Nothing
  • True

Question 8

Question
8. What are the three steps in using a function?
Answer
  • Definition, prototype, invocation
  • Prototype, argument, signature
  • Definition, invocation, argument

Question 9

Question
9. write mpg() function prototype, that takes two type double arguments and returns a double
Answer
  • Double mpg(double a, double b)
  • Void mpg(){}
  • Float mpg(int a){ float b = 1; return b;}
  • Double mpg(int a, double b)

Question 10

Question
10. What is data structure?
Answer
  • is a group of data elements grouped together under one name
  • is a group of data elements grouped together under two names.
  • is a set of some elements grouped together under value
  • is a group of data elements together with some name.

Question 11

Question
11. The data elements in structure are also known as what?
Answer
  • Members
  • Data
  • Objects
  • None of the above

Question 12

Question
12. What will be used when terminating a structure?
Answer
  • Semicolon
  • Colon
  • Brackets
  • Dot

Question 13

Question
13. Which stream class is used to both read and write on files?
Answer
  • Fstream
  • Iostream
  • Ofstream
  • Ifstream

Question 14

Question
14. Which stream class is only used to read files
Answer
  • Ifstream
  • Ofstream
  • Iostream
  • Fstream

Question 15

Question
15. What is the difference between array and structure?
Answer
  • Structure can include members of different data types
  • No difference
  • Only on their declaration
  • Arrays can include only integers

Question 16

Question
16. What is the output from the following program code?
Answer
  • 10 10 10 10 10
  • 11 11 11 11 11
  • 10
  • 0 1 2 3 4
  • Error

Question 17

Question
17. The OR (||) operator:
Answer
  • Stops evaluation upon finding one condition to be true
  • Has higher precedence that AND (&&) operator
  • True if all conditions are true
  • Associates from right to left

Question 18

Question
18. Which of the following for headers is not valid for C++ code?
Answer
  • for (integer i =0; j<10; i++);
  • for (int i = 0; i<9; i++)
  • for (int i = 0; i<8; i++)
  • for (int i = 0; i<7; i++)
  • all

Question 19

Question
19. There might be functions with the same name, but different arguments. The function called is the one whose arguments match the invocation. What is this mean?
Answer
  • Function overloading
  • Function overprocessing
  • Argument type error
  • Argument dispatch error

Question 20

Question
20. Which of the following cannot be used to create a random numbers?
Answer
  • structures
  • float
  • int
  • none of the mentioned

Question 21

Question
21. Please evaluate !(1 && !(0 || 1)).
Answer
  • True
  • False
  • Unevaluatable
  • Not sure

Question 22

Question
22. What is the final value of x when the code int x; for(x=0; x<50; x++) {} is run?
Answer
  • 10
  • 50
  • 0
  • 51

Question 23

Question
23. How many times is a do while loop guaranteed to loop?
Answer
  • 0
  • Infinitely
  • 1
  • Variable

Question 24

Question
24. What is the output of the following code?
Answer
  • value
  • 77.5
  • Float
  • Variable

Question 25

Question
25. Which of the following is a valid function call (assuming the function exists)?
Answer
  • funct;
  • funct x, y;
  • funct();
  • struct funct();

Question 26

Question
26. Which of the following is a complete function?
Answer
  • int funct();
  • int funct(int x) {return x=x+1;}
  • void funct[int] {cout&tl;<"Hello"}
  • void funct{x} {cout<<"Hello"}

Question 27

Question
27. Which of the following is required to avoid falling through from one case to the next?
Answer
  • End;
  • Break;
  • Stop;
  • A semicolon;

Question 28

Question
28. Which of the following is the proper declaration of a pointer?
Answer
  • int x;
  • int &x;
  • ptr x;
  • int *x;

Question 29

Question
29. Which of the following gives the memory address of integer variable a?
Answer
  • *a;
  • a;
  • &a;
  • address(a);

Question 30

Question
30. Which of the following gives the memory address of a pointer a?
Answer
  • a;
  • *a;
  • &a;
  • address(a);

Question 31

Question
31. Which of the following gives the value stored at the address pointed to by the pointer a?
Answer
  • a;
  • val(a);
  • *a;
  • &a;

Question 32

Question
32. Which of the following gives the value stored at the address pointed to by the pointer ptr?
Answer
  • ptr;
  • val(ptr);
  • *ptr;
  • &ptr;

Question 33

Question
33. Which of the following accesses a variable in structure b?
Answer
  • b->var;
  • b.var;
  • b-var;
  • b>var;

Question 34

Question
34. Which of the following accesses a variable in structure mystruct?
Answer
  • mystruct ->var;
  • mystruct.var;
  • mystruct -var;
  • mystruct >var;

Question 35

Question
35. Which of the following correctly accesses the seventh element stored in diana, an array with 100 elements?
Answer
  • diana[6]
  • diana[7]
  • diana(7)
  • diana;

Question 36

Question
36. What is the correct way to write the condition y < x < z?
Answer
  • ((y < x) && (x < z))
  • ((y < x) || (x < z))
  • ((y < x) & (x < z))
  • ((y < x) AN (x < z))

Question 37

Question
37. The value 132.54 can represented using which data type?
Answer
  • Double
  • Void
  • Integer
  • Bool

Question 38

Question
38. In an assignment statement “ a=b; ” which of the following statement is true?
Answer
  • The variable a and the variable b are equal.
  • The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable
  • The value of variable a is assigned to variable b and the value of variable b is assigned to variable a.

Question 39

Question
39. The difference between while structure and do structure for looping is
Answer
  • In while statement the condition is tested at the end of first iteration
  • In do structure the condition is tested at the beginning of first iteration
  • The do structure decides whether to start the loop code or not whereas while statement decides whether to repeat the code or not
  • In while structure condition is tested before executing statements inside loop whereas in do structure condition is tested before repeating the statements inside loop

Question 40

Question
40. A function that calls itself for its processing is known as
Answer
  • Inline Function
  • Nested Function
  • Overloaded Function
  • Recursive Function

Question 41

Question
41. The keyword endl
Answer
  • Ends the execution of program where it is written
  • Ends the output in cout statement
  • Ends the line in program. There can be no statements after endl
  • Ends current line and starts a new line in cout statement

Question 42

Question
42. Strings are character arrays. The last index of it contains the nullterminated character
Answer
  • \n
  • \t
  • \0
  • \1

Question 43

Question
43. Variables inside parenthesis of functions declarations have _____ level access
Answer
  • Local
  • Global
  • Module
  • Universal

Question 44

Question
44. Array indexing always starts with the number
Answer
  • 0
  • 1
  • -1
  • 10

Question 45

Question
45. Which of the following accesses a variable in structure st1?
Answer
  • st1->var;
  • st1.var;
  • st1-var;
  • st1>var;

Question 46

Question
46. Which looping process is best used when the number of iterations is known?
Answer
  • For
  • While
  • Do-while
  • Nothing

Question 47

Question
47. 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 the ending of the loop block?
Answer
  • parentheses ( )
  • braces { }
  • brackets [ ]
  • arrows < >

Question 48

Question
48. A memory address is…
Answer
  • where a variable is stored.
  • where a variable is defined.
  • where a variable is declares.
  • where a variable is print out.

Question 49

Question
49. The set of instructions that a computer will follow is known as..
Answer
  • program
  • variable
  • computer
  • brackets

Question 50

Question
50. cin >> number; is
Answer
  • an output statement
  • a colon
  • a variable
  • an input statement

Question 51

Question
51. cout << "How many items would you want?\n"; is
Answer
  • an output statement
  • a colon
  • a variable
  • an input statement

Question 52

Question
52. int number; is
Answer
  • an output statement
  • a variable declaration
  • a variable
  • an input statement

Question 53

Question
53. If x is 0, what is the value of (!x == 0)?
Answer
  • True
  • False
  • 2
  • 15

Question 54

Question
54. How to create array with n integers?
Answer
  • int n; cin >> n; int a = new# int[n];
  • int n; cin >> n; int& a; a = new int[n];
  • int n; cin >> n; int* a; a = new int[n];
  • int n; cin >> n; int a; a = new% int[n];

Question 55

Question
55. Which class should be included to work with files?
Answer
  • iostream
  • string
  • cmath
  • fstream

Question 56

Question
56. Which of the following is the output from the following C++ code?
Answer
  • 15 14 13 12 11 10
  • 15 14 13 12 11 10 9
  • 9
  • 15

Question 57

Question
57. If originally x=0, y=1, and z=3, what is the value of x, y, and z after executing the following code ?
Answer
  • x=0 y=3 z=3
  • x=0 y=1 z=3
  • x=3 y=3 z=3
  • x=3 y=1 z=0

Question 58

Question
58. What is the value of x after the following statements?
Answer
  • 10
  • 33
  • 3
  • 0

Question 59

Question
59. What is the value of x after the following statements?
Answer
  • 15
  • 3
  • 4
  • 0

Question 60

Question
60. Which of the following is the output from the following C++?
Answer
  • 5
  • 0
  • 4
  • 6

Question 61

Question
61. Given the following code fragment, what is the final value of y?
Answer
  • 8
  • 2
  • 4
  • 3

Question 62

Question
62. Which of the following is the output from the following C++ code
Answer
  • 10
  • 12
  • 3
  • 4

Question 63

Question
64. Which of the following is the final value of y from the following C++ code
Answer
  • 2
  • 3
  • 22
  • 0

Question 64

Question
63. Which of the following is the output from the following C++ code?
Answer
  • 6
  • 0
  • 4
  • 5

Question 65

Question
65. Which of the following is the final value of ‘i’ from the following C++ code ?
Answer
  • 5
  • 4
  • 0 1 2 3 4
  • 0 1 2 3 4 5

Question 66

Question
66. What is the value of x after the following code executes?
Answer
  • 10
  • 11
  • 13
  • 0

Question 67

Question
67. Given the following code, what is the final value of i?
Answer
  • 2
  • 4
  • 3
  • 0

Question 68

Question
68. What is the value of x after the following code executes?
Answer
  • 10
  • 11
  • 13
  • 0

Question 69

Question
69. What is the output of the following code segment?
Answer
  • 15
  • 25
  • 5
  • 0

Question 70

Question
70. What does the following code print to the screen?
Answer
  • 7
  • cout
  • int
  • world

Question 71

Question
71. What is the value of x after the following statements?
Answer
  • 15
  • 10
  • 5
  • 25

Question 72

Question
72. What is the value of x after the following statements?
Answer
  • 25
  • 4
  • 5
  • 1

Question 73

Question
73. What is the value of x after the following code executes?
Answer
  • 10
  • 11
  • 23
  • 13

Question 74

Question
74. Given the following code, what is the final value of i?
Answer
  • 5
  • 2
  • 3
  • 0

Question 75

Question
75. Given the following code, what is the final value of i?
Answer
  • 4
  • 6
  • 5
  • 0

Question 76

Question
76. Which of the following is the valid array declaration
Answer
  • int num(5)
  • int mycat[5]
  • Array. double[5] marks
  • Myarray.counter int[5]

Question 77

Question
77. What is the output of the following code?
Answer
  • 7
  • Value
  • 1
  • 6

Question 78

Question
78. What is the value of x after the following statements ?
Answer
  • 11
  • 10
  • 0
  • 12

Question 79

Question
79. What is the final output of the following code fragment ?
Answer
  • 22
  • 23
  • 20
  • 0

Question 80

Question
80. Solve the following piece of code and choose the best answer?
Answer
  • The function addition is called by passing the values
  • The function addition is called by passing reference
  • Both of above
  • None of above

Question 81

Question
81. If the type specifies of parameters of a function is followed by an ampersand &, that function call is…
Answer
  • Pass by value
  • Pass by reference
  • All of answers
  • None of answers

Question 82

Question
82. Which of the following gives the memory address of a pointer pt1?
Answer
  • *pt1;
  • pt1;
  • &pt1;
  • address(ptr1);

Question 83

Question
83. What is the value of x after the following statement?
Answer
  • 1.75
  • 50
  • 30
  • 20

Question 84

Question
84. What is the final value of x after the following fragment of codeexecutes ?
Answer
  • Infinite loop
  • Never
  • 1
  • 0

Question 85

Question
85. What is the value of x after the following statement?
Answer
  • 3.75
  • 1.75
  • 2
  • 0

Question 86

Question
86. What is the value of x after the following statements ?
Answer
  • 7
  • 10
  • 3
  • 33

Question 87

Question
87. What is the value of x after the following statements?
Answer
  • 70
  • 30
  • 3
  • 33

Question 88

Question
88. Given the following code fragment, what is the output
Answer
  • 5
  • That is all. Goodbye
  • X is bigger than 5
  • X

Question 89

Question
89. How many times is "Hi" printed to the screen ?
Answer
  • 0
  • 1
  • 14
  • 15

Question 90

Question
90. How to read file and take first string?
Answer

Question 91

Question
91. How to write to file?
Answer

Question 92

Question
92. There is given array with n elements, created as pointer. How to remove it correctly?
Answer
  • delete a;
  • delete[] a;
  • remove[] a;
  • remove a;

Question 93

Question
93. How to write correct recursive function for making sum of n numbers?

Question 94

Question
94. How to make several items in structure? Just think that you have “HOME”, and n items in it

Question 95

Question
95. Find mistake of next cod ?
Answer
  • No mistakes, it will just read from file and print first string in command line
  • Mistake in opening file, should be: file.open(“input.txt”);
  • It should write in other file; it can’t write directly to command line.
  • It should read from read from file, when we want to write in command line.

Question 96

Question
96. What will print in command line next code ?
Answer
  • Read first string from file “input.txt”, and print it in command line.
  • It will give an error, because, file should read in this way: file.open(“input.txt”);
  • It won’t print anything.
  • Read all lines and print it in new file.

Question 97

Question
97. Which one will be correct function for ?

Question 98

Question
98. There are given array “numbers” with 10 numbers. How to make sum of all numbers, which are located in odd indexes?

Question 99

Question
99. There is given string named “str”. How to print in command line length of str?
Answer
  • cout << str.count();
  • cout << str.length;
  • cout << str.lenth();
  • cout >> str.lenth();

Question 100

Question
100. How to implement array of chars with 10 elements?
Answer
  • char* chs; chs = new char(10);
  • char chs; chs = char[10];
  • char chs[10];
  • char chs[] = new char[10];

Question 101

Question
101. How to implement array of integer numbers with n elements, and how to delete them correctly?
Answer
  • int n; cin >> n; int* a; a = new% int[n]; delete[] a;
  • int n; cin >> n; int& a; a = new int[n]; delete[] a;
  • int n; cin >> n; int* a; a = new@ int[n]; delete[n] a;
  • int n; cin >> n; int* a; a = new& int[n]; for(int i=0; i<n; i++) delete a;

Question 102

Question
102. How to get whole string in one line (in command line)?
Answer
  • string s; getline(cin, s);
  • string s; getline(cout, s);
  • string s; cin >> s;
  • string s; cout << s;

Question 103

Question
103. How to get whole string in one line (in file)?
Answer
  • ifstream file; string s; getline(file, s);
  • ifstream file; string s; getline(cin, s);
  • ifstream file; string s; getline(cout, s);
  • ifstream file; string s; file >> s;

Question 104

Question
104. Why do we need library?
Answer
  • To work with strings.
  • To work with files.
  • To work with mathematical functions.
  • To work with our own libraries.

Question 105

Question
105. Why do we need library <cmath>?
Answer
  • To work with strings.
  • To work with mathematical functions.
  • To work with command line.
  • To work with our own libraries.

Question 106

Question
106. Where is the mistake of the code ?
Answer
  • Variable “a” do not have any values.
  • Library didn’t included.
  • Library didn’t included.
  • Library didn’t included

Question 107

Question
107. What will be printed in the part of the cod?
Answer
  • 1 4 7 10
  • 0 3 6 9
  • 3 6 9
  • 9 6 3 0

Question 108

Question
108. What will be printed in the part of the code?
Answer
  • 0 8 16 24 32
  • 2 10 18 26 34
  • 6 12 20 28 36
  • 4 10 18 26 34

Question 109

Question
109. Which of the following is the proper keyword to allocate memory?
Answer
  • new
  • malloc
  • create
  • value

Question 110

Question
110. Which of the following is the proper keyword to deallocate memory?
Answer
  • free
  • delete
  • clear
  • remove

Question 111

Question
111. Assume if A = 10; and B = 15; with using bitwise OR operator Find A||B
Answer
  • 10
  • 15
  • 61
  • 13

Question 112

Question
112. The notation of logical NOT operator in a C++ program is
Answer
  • !
  • :
  • ;
  • None of above

Question 113

Question
113. Which of the following denote C++ looping statement?
Answer
  • All of them
  • for
  • while
  • do-while

Question 114

Question
Cin in C++ program uses the operator
Answer
  • >>
  • <<
  • >
  • ||

Question 115

Question
What is the minimum number of times a do loop would definitely get executed?
Answer
  • 1
  • inf
  • 0
  • None of the above

Question 116

Question
The function named as exforsys declared as int exforsys(float x, double y) has return type as
Answer
  • int
  • char
  • double
  • string

Question 117

Question
Which of the following is mandatory for all C++ program?
Answer
  • main()
  • void()
  • system()
  • None of the above

Question 118

Question
Which of the following denote newline character in C++ program?
Answer
  • “\n”
  • end
  • “/n”
  • enl

Question 119

Question
Which of the following is used to group a set of objects and functions under a name?
Answer
  • namespace
  • name
  • namearea
  • areaname

Question 120

Question
What is the notation used to place block of statements in a looping structure in C++?
Answer
  • { }
  • [ ]
  • ( )
  • " "

Question 121

Question
What is the notation used show the size of array?
Answer
  • [ ]
  • { }
  • ( )
  • " "

Question 122

Question
How many values can be returned by a C++ function?
Answer
  • 1
  • Inf
  • 0
  • None of the above

Question 123

Question
123. Which of the following is returned by the system if a C++ program completes successfully?
Answer
  • 0
  • 1
  • -1
  • Inf

Question 124

Question
124. The variables that can be used only within the function in which it is declared is called as
Answer
  • local
  • global
  • both of them
  • none of them

Question 125

Question
125. Comments in C++ program is written by using
Answer
  • //
  • --
  • <!-->
  • <>

Question 126

Question
126. The array exforsys[10] can be declared using pointers as
Answer
  • * exforsys[ ]
  • exforsys[ ]
  • $exforsys[ ]
  • &amp;exforsys[ ]

Question 127

Question
127. Default size of int in c++ (in bytes)
Answer
  • 4
  • 8
  • 16
  • 2

Question 128

Question
128. Default size of double in c++ (in bytes)
Answer
  • 16
  • 8
  • 4
  • 2

Question 129

Question
129. Default value of boolean
Answer
  • false
  • true

Question 130

Question
130. If a function in C++ does not return a value then its return type is denoted as
Answer
  • void
  • int
  • double
  • bool

Question 131

Question
131. A user defined header file is included by following statement in general.
Answer
  • #include "file.h"
  • #include <file.h>
  • #include file.h
  • #include <file>

Question 132

Question
132. An inline function can execute faster than a normal function.
Answer
  • True
  • False

Question 133

Question
133. What value must a destructor return?
Answer
  • Destructors do not return a value.
  • A pointer to the class.
  • An object of the class.
  • A status code determining whether the class was destructed correctly

Question 134

Question
134. What character ends all strings?
Answer
  • ‘\o’
  • ‘\n’
  • ‘’
  • ‘.’

Question 135

Question
135. Which of the following reads in a string named x with one hundred characters?
Answer
  • cin.getline(x, 100, &#39;\n&#39;);
  • cin.getline(100, x, &#39;\n&#39;);
  • readline(x, 100, &#39;\n&#39;);
  • read(x);

Question 136

Question
136. Which of the following functions compares two strings?
Answer
  • strcmp();
  • cmp();
  • stringcompare();
  • compare();

Question 137

Question
137. Which of the following adds one string to the end of another?
Answer
  • strcat();
  • append();
  • stradd();
  • stringadd();

Question 138

Question
138. Which of the following correctly declares an array?
Answer
  • int anarray[10];
  • int anarray;
  • anarray{10};
  • array anarray[10];

Question 139

Question
139. What is the index number of the last element of an array with 29 elements?
Answer
  • 28
  • 29
  • 0
  • 27

Question 140

Question
140. Which of the following is a two-dimensional array?
Answer
  • int anarray[20][20];
  • array anarray[20][20];
  • int array[20, 20];
  • char array[20];

Question 141

Question
141. Which of the following correctly accesses the seventh element stored in foo, an array with 100 elements?
Answer
  • foo[6]
  • foo[7]
  • foo(6)
  • foo

Question 142

Question
142. Which of the following accesses a variable in structure b?
Answer
  • b.var
  • b-&gt;var
  • b-var
  • b&gt;var

Question 143

Question
143. Which of the following accesses a variable in structure *b?
Answer
  • b-&gt;var
  • b.var
  • b-var
  • b&gt;var

Question 144

Question
144. Which of the following is a properly defined struct?
Answer
  • struct a_struct {int a;};
  • struct a_struct {int a;}
  • struct {int a;}
  • struct a_struct int a;

Question 145

Question
145. Which properly declares a variable of struct foo?
Answer
  • foo var
  • struct foo
  • foo
  • int foo

Question 146

Question
146. Which of the following is the proper declaration of a pointer?
Answer
  • int *x;
  • int &amp;x;
  • ptr x;
  • int x;

Question 147

Question
147. Which of the following gives the memory address of integer variable a?
Answer
  • &amp;a;
  • *a;
  • address(a);
  • a;

Question 148

Question
148. Which of the following gives the value stored at the address pointed to by the pointer a?
Answer
  • *a;
  • &amp;a;
  • a;
  • val(a);

Question 149

Question
149. Which of the following is the proper keyword to allocate memory?
Answer
  • new
  • malloc
  • create
  • value

Question 150

Question
150. Which of the following is the proper keyword to deallocate memory?
Answer
  • delete
  • clear
  • remove
  • free

Question 151

Question
151. What is the notation used to place block of statements in a looping structure in C++?
Answer
  • { }
  • [ ]
  • ( )
  • " "

Question 152

Question
152. What is the notation used show the size of array?
Answer
  • [ ]
  • { }
  • ( )
  • " "

Question 153

Question
153. How many values can be returned by a C++ function?
Answer
  • 1
  • Inf
  • 0
  • None of the above

Question 154

Question
154. Which of the following is returned by the system if a C++ program completes successfully?
Answer
  • 0
  • 1
  • -1
  • Inf

Question 155

Question
155. The variables that can be used only within the function in which it is declared is called as
Answer
  • local
  • global
  • both of them
  • none of them

Question 156

Question
156. Comments in C++ program is written by using
Answer
  • //
  • --
  • <!-->
  • <>

Question 157

Question
157. The array exforsys[10] can be declared using pointers as
Answer
  • * exforsys[ ]
  • exforsys[ ]
  • $exforsys[ ]
  • &amp;exforsys[ ]

Question 158

Question
158. Default size of int in c++ (in bytes)
Answer
  • 4
  • 8
  • 16
  • 2

Question 159

Question
159. Default size of double in c++ (in bytes)
Answer
  • 16
  • 8
  • 4
  • 2

Question 160

Question
160. Default value of boolean
Answer
  • false
  • true

Question 161

Question
161. If a function in C++ does not return a value then its return type is denoted as
Answer
  • void
  • int
  • double
  • bool

Question 162

Question
162. A user defined header file is included by following statement in general.
Answer
  • #include “file.h”
  • #include <file.h>
  • #include file.h
  • #include <file>

Question 163

Question
163. An inline function can execute faster than a normal function.
Answer
  • True
  • False

Question 164

Question
164. What value must a destructor return?
Answer
  • Destructors do not return a value.
  • A pointer to the class.
  • An object of the class.
  • A status code determining whether the class was destructed correctly

Question 165

Question
165. What character ends all strings?
Answer
  • ‘\o’
  • ‘\n’
  • ‘’
  • ‘.’

Question 166

Question
166. Which of the following reads in a string named x with one hundred characters?
Answer
  • cin.getline(x, 100, &#39;\n&#39;);
  • cin.getline(100, x, &#39;\n&#39;);
  • readline(x, 100, &#39;\n&#39;);
  • read(x);

Question 167

Question
167. Which of the following functions compares two strings?
Answer
  • strcmp();
  • cmp();
  • stringcompare();
  • compare();

Question 168

Question
168. Which of the following adds one string to the end of another?
Answer
  • strcat();
  • append();
  • stradd();
  • stringadd();

Question 169

Question
169. Which of the following correctly declares an array?
Answer
  • int anarray[10];
  • int anarray;
  • anarray{10};
  • array anarray[10];

Question 170

Question
170. What is the index number of the last element of an array with 29 elements?
Answer
  • 28
  • 29
  • 0
  • 27

Question 171

Question
171. Which of the following is a two-dimensional array?
Answer
  • int anarray[20][20];
  • array anarray[20][20];
  • int array[20, 20];
  • char array[20];

Question 172

Question
172. Which of the following correctly accesses the seventh element stored in foo, an array with 100 elements?
Answer
  • foo[6]
  • foo[7]
  • foo(6)
  • foo

Question 173

Question
173. Which of the following accesses a variable in structure b?
Answer
  • b.var
  • b-&gt;var
  • b-var
  • b&gt;var

Question 174

Question
174. Which of the following accesses a variable in structure *b?
Answer
  • b-&gt;var
  • b.var
  • b-var
  • b&gt;var

Question 175

Question
175. Which of the following is a properly defined struct?
Answer
  • struct a_struct {int a;};
  • struct a_struct {int a;}
  • struct {int a;}
  • struct a_struct int a;

Question 176

Question
176. Which properly declares a variable of struct foo?
Answer
  • foo var
  • struct foo
  • foo
  • int foo

Question 177

Question
177. Which of the following is the proper declaration of a pointer?
Answer
  • int *x;
  • int &amp;x;
  • ptr x;
  • int x;

Question 178

Question
178. Which of the following gives the memory address of integer variable a?
Answer
  • &a;
  • *a;
  • address(a);
  • a;

Question 179

Question
179. Which of the following gives the value stored at the address pointed to by the pointer a?
Answer
  • *a;
  • &amp;a;
  • a;
  • val(a);

Question 180

Question
180. Which of the following is the proper keyword to allocate memory?
Answer
  • new
  • malloc
  • create
  • value

Question 181

Question
1. Use the following declaration and initialization to evaluate the Java expressions int a = 2, b = 3, c = 4, d = 5; cout &lt;&lt; ( b * a + c *d --);
Answer
  • 26
  • 24
  • 22
  • 28

Question 182

Question
181. Use the following declaration and initialization to evaluate the Java expressions int a = 2, b = 3, c = 4, d = 5; cout &lt;&lt; (++d);
Answer
  • 6
  • 5
  • 1
  • 4

Question 183

Question
182. Use the following declaration and initialization to evaluate the Java expressions int a = 2, b = 3, c = 4, d = 5; cout &lt;&lt; (c = d + c++);
Answer
  • 9
  • 10
  • 8
  • 4

Question 184

Question
183. Use the following declaration and initialization to evaluate the Java expressions int a = 2, b = 3, c = 4, d = 5; cout &lt;&lt; (c = d + ++c);
Answer
  • 10
  • 9
  • 4
  • 8

Question 185

Question
2. In a class definition, the special method provided to be called to create an instance of that class is known as a/an
Answer
  • Constructor
  • Destructor
  • Object
  • Compiler

Question 186

Question
184. ……………….. are used to document a program and improve its readability.
Answer
  • Comments
  • Keywords
  • Control structures
  • Blocks

Question 187

Question
185. Members of a class specified as ……………….. are accessible only to methods of that class. 
Answer
  • private
  • public
  • protected
  • none of them

Question 188

Question
186. Use the following declaration and initialization to evaluate the Java expressions int a = 2, b = 3, c = 4, d = 5; cout &lt;&lt; ( --b * a + c *d --);
Answer
  • 24
  • 21
  • 22
  • 28

Question 189

Question
187. Use the following declaration and initialization to evaluate the Java expressions int a = 2, b = 3, c = 4, d = 5; cout &lt;&lt; (a++);
Answer
  • 2
  • 1
  • Syntax error
  • 3

Question 190

Question
188. Use the following declaration and initialization to evaluate the Java expressions int a = 2, b = 3, c = 4, d = 5; cout &lt;&lt; (c = c++);
Answer
  • 4
  • 5
  • 8
  • 2

Question 191

Question
189. Identify, from among the following, the incorrect variable name
Answer
  • 2ndName
  • _theButton
  • my2ndFont.
  • CurrentWeatherStateofplanet

Question 192

Question
190. An overloaded method consists of: i) The same method name with different types of parameters ii) The same method name with different number of parameters iii) The same method name and same number and type of parameters
Answer
  • Both i and ii
  • all of them
  • none of them
  • only i

Question 193

Question
191. You read the following statement in a C++ program that compiles and executes. submarine.dive(depth); What can you say for sure?
Answer
  • dive must be a method.
  • depth must be an int
  • submarine must be the name of a class
  • submarine must be a method.

Question 194

Question
192. What is the type and value of the following expression? - 4 + 1/2 + 2*-3 + 5.0
Answer
  • double -5.0
  • int -5
  • double -4.5
  • none of the above

Question 195

Question
193. What is printed by the following statement? cout &lt;&lt; (“Hello,\nworld!”);
Answer
  • Hello, world!
  • Hello, \nworld!
  • Hello, world
  • “Hello, \nworld!”

Question 196

Question
194. Which of the following variable declaration would NOT compile in a java program?
Answer
  • int 1_var;
  • int var_1;
  • int var;
  • int VAR;

Question 197

Question
3. _________ is a paradigm based on the concepts of “object” that contains data and methods
Answer
  • Object-oriented programming
  • Object-based programming
  • Data-oriented programming
  • Method-oriented programming

Question 198

Question
195. Two or more methods with same name in the same class with different arguments is called as
Answer
  • Method overloading
  • Method overriding
  • Method overridden
  • none of the above

Question 199

Question
196. Constructors are used to
Answer
  • Initialize a newly create object.
  • Free memory
  • To create a subclass
  • To build a user interface

Question 200

Question
197. Syntax of loop for (declaration; condition; increment/decrement){}
Answer
  • False
  • True
Show full summary Hide full summary

Similar

State & Local Govt - Budgetary Accounting
turquoise_cat
Liberalism Mindmap
floragair
3. Describe the state of nature for Hobbes, Locke, and Rousseau.
Elisabeth Morell
Woody, Alternate, Simple, Families F-R
Wes Smalley
body parts and sickness
Ambre Badipi
types of economy
Jesse McNab
War on Terror
Wesley Spearman
React siblings components
Kostas Diakogiannis
Liberalism Mindmap
hollie garner
United States Capitals
Rob Perry
Secularism
Selective Study