CS201-Midterm
1 / 50
What will be the value of i and j in the following code segment?
int i, j ;
int x[5] = {2, 3, 4, 8, 9} ;
int *ptr =&x[2];
i = (*ptr)++ ;
j = *ptr++ ;
2 / 50
If the break statement is missed in switch statement then,
3 / 50
The size of int data type is
4 / 50
Consider the following code segment. What will be the output of this code segment?
int arr[6] = {2, 3, 7, 4, 5, 6} ;
int *ptr1 =&arr[1] ;
int *ptr2 = &arr[4] ;
cout << (ptr2-ptr1) ;
5 / 50
In order to get 256 from the number 2568 we divide this number by 10 and take,
6 / 50
When an array element is passed to a function, it is passed by ----------------.
7 / 50
What is the output of the following statement?
int i = 2.5; do { cout i * 2; } while (i > 3 && i < 10);
8 / 50
How many bytes will the pointer INTPTR of type int move in the following statement? intPtr += 3 ;
9 / 50
Each pass through a loop is called a/an
10 / 50
The variables having a name, type and size are just like empty boxes.
11 / 50
A continue statement causes execution to skip to
12 / 50
&& is------------------ operator.
13 / 50
Commenting the code ___________
14 / 50
What will be the value of ‘a’ and ‘b’ after executing the following statements?
a = 3; b = a++;
15 / 50
Syntax of union is identical to ______
16 / 50
The function of cin is
17 / 50
What is the correct syntax to declare an array of size 10 of int data type?
18 / 50
If there are 2(n+1) elements in an array then what would be the number of iterations required to search a number using binary search algorithm?
19 / 50
Analysis is the -------------- step in designing a program
20 / 50
C is a/an ______ language
21 / 50
UNIX has been developed in ________ language.
22 / 50
How many bytes are occupied by declaring following array of characters? char str[] = “programming”;
23 / 50
If we want to store a string “abc” in an array str then the size of this array must be at least,
24 / 50
The remainder (%) operator is,
25 / 50
43.For which array, the size of the array should be one more than the number of elements in an array?
26 / 50
Dealing with structures and functions passing by reference is the most economical method
27 / 50
Which of the following functionreturns the size of a string variable?
28 / 50
We want to access array in random order which approach is better?
29 / 50
Searching is easier when an array is already sorted
30 / 50
The data type before a function name represents its,
31 / 50
Which of the following is an extension of header file?
32 / 50
The size of a double variable is
33 / 50
Which of the following header file defines the rand() function?
34 / 50
For which values of the integer _value will the following code becomes an infinite loop?
int number=1;
while (true) {
cout << number;
if (number == 3) break;
number += integer_value; }
any number other than 1 or 2
35 / 50
Initialization of variable at the time of definition is,
36 / 50
Which of the following is the correct statement for the following declaration?
37 / 50
What will be the result of arithmetic expression 6+27/3*3?
38 / 50
What does 5 ^ 6 , evaluate to in decimal where ‘^’ is Exclusive OR operator?
39 / 50
The address operator (&) can be used with,
40 / 50
If an array has 100 elements, what is allowable range of subscripts?
41 / 50
What will be the correct syntax for initialization of pointer ptr with string "programming"?
42 / 50
In C/C++ language the header file which is used to perform useful task and manipulation of character data is
43 / 50
Which character is inserted at the end of string to indicate the end of string?
44 / 50
Declaring structures does not mean that memory is allocated.
45 / 50
What's wrong with this for loop? for (int k = 2, k <=12, k++)
46 / 50
In C/C++ the #include is called,
47 / 50
Carefully analyze the following lines of code and chose the correct option.
ch1=”a”;
ch2=’a’;
48 / 50
A precise sequence of steps to solve a problem is called
49 / 50
Which of the following function(s) is/are included in stdlib.h header file?
50 / 50
In C/C++ the string constant is enclosed
Your score is
The average score is 73%
Restart quiz