Sunteți pe pagina 1din 8

VERNALIS SYSTEMS

TECHNICAL QUESTION SET 6


1. What will happen in this code?
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
2.The operator used for dereferencing or indirection is ____ a) * b) & c) -> d) –>>
3. 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 pointer to string types d) none of the mentioned
4. Which one of the following is not a possible state for a pointer.
a) hold the address of the specific object b) point one past the end of an object
c) zero d) point to a tye
5. Which of the following is illegal?
a) int *ip; b) string s, *sp = 0; c) int i; double* dp = &i; d) int *pi = 0;
6.Different ways to initialize an array with all elements as zero are
a) int array[5] = {}; b) int array[5] = {0}; c) int a = 0, b = 0, c = 0; int array[5] = {a, b, c};
d) All of the mentioned
7. Which of the following declaration is illegal?
a) int a = 0, b = 1, c = 2; int array[3] = {a, b, c}; b) int size = 3; int array[size];
c) int size = 3; int array[size] = {1, 2, 3}; d) All of the mentioned
8. An array of similar data types which themselves are collection of dissimilar data type are
a) Linked Lists b) Trees c) Array of Structure d) All of the mentioned
9. The syntax to print a % using printf statement can be done by.
a) % b) % c) ‘%’ d) %%
10.The standard header _______ is used for variable list arguments (…) in C.
a) <stdio.h > b) <stdlib.h> c) <math.h> d) <stdarg.h>
11. Which of these keywords is used to define packages in Java?
a) pkg b) Pkg c) package d) Package
12. Which of these is a mechanism for naming and visibility control of a class and its content?
a) Object b) Packages c) Interfaces d) None of the Mentioned.
13. Which of this access specifies can be used for a class so that its members can be accessed by a different
class in the same package? a) Public b) Protected c) No Modifier d) All of the
mentioned
14. Which of the following package stores all the standard java classes?
a) lang b) java c) util d) java.packages
15. Which of these method of String class can be used to test to strings for equality?
a) isequal() b) isequals() c) equal() d) equals()
16.A few lines in an HTML paragraph are to be formatted differently from the rest of the lines. Which tag will
assist in this? A.div B.p C.span D.format
17.What does an HTML tag do?
A.It specifies formatting and layout instructions for your web page.
B.It hides programming instructions from view.
C.It determines the organizational structure of your Web site.
D.It connects your web site to an operating environment.
18.When you use a heading tag in a document, what does the Web browser assumes?
A.Heading information is to appear in bold letters
B.Heading information is to appear on its own line
C.Heading information has a hyperlink
D.Heading information is shown as a size six
19.What is meant by the cellspacing attribute?
A.It makes the cell span more than one column
B.It specifies the space between the cell wall and the contents of the cell.
C.It specifies the space between two cells.
D.It makes the cell span more than one row
20.Which of the following attributes comes in handy when borders have to be put between groups of columns
instead of every column?
A.col B.colgroup C.rowspan D.row
21. In SQL, which command is used to remove a stored function from the database?
A) REMOVE FUNCTION B) DELETE FUNCTION C) DROP FUNCTION
D) ERASE FUNCTION
22. In SQL, which command is used to select only one copy of each set of duplicate rows
A) SELECT DISTINCT B) SELECT UNIQUE C) SELECT DIFFERENT
D) All of the above
23. Count function in SQL returns the number of A) Values B) Distinct values C) Groups D)
Columns
24. Composite key is made up of ................
A) One column B) One super key C) One foreign key D) Two or more columns
25. What command is used to get back the privileges offered by the GRANT command?
A) Grant B) Revoke C) Execute D) Run
PREDICT THE OUTPUT
26. What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
int a = 5, b = 10, c = 15;
int *arr[ ] = {&a, &b, &c};
cout << arr[1];
return 0;
}
a) 5 b) 10 c) 15 d) it will return some random number
27. What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
int i;
char *arr[] = {"C", "C++", "Java", "VBA"};
char *(*ptr)[4] = &arr;
cout << ++(*ptr)[2];
return 0;
}
a) ava b) java c) c++ d) compile time error
28. What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
int arr[] = {4, 5, 6, 7};
int *p = (arr + 1);
cout << *p;
return 0;
}
a) 4 b) 5 c) 6 d) 7
29. What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
int arr[] = {4, 5, 6, 7};
int *p = (arr + 1);
cout << arr;
return 0;
}
a) 4 b) 5 c) address of arr d) 7
30. What is the output of this program?
#include <iostream>
using namespace std;
int main ()
{
int numbers[5];
int * p;
p = numbers; *p = 10;
p++; *p = 20;
p = &numbers[2]; *p = 30;
p = numbers + 3; *p = 40;
p = numbers; *(p + 4) = 50;
for (int n = 0; n < 5; n++)
cout << numbers[n] << ",";
return 0;
}
a) 10,20,30,40,50, b) 1020304050 c) compile error d) runtime error
31. What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
int arr[] = {4, 5, 6, 7};
int *p = (arr + 1);
cout << *arr + 9;
return 0;
}
a) 12 b) 5 c) 13 d) error
32. What is the output of this program?
#include <iostream>
using namespace std;
long factorial (long a)
{
if (a > 1)
return (a * factorial (a + 1));
else
return (1);
}
int main ()
{
long num = 3;
cout << num << "! = " << factorial ( num );
return 0;
}
a) 6 b) 24 c) segmentation fault d) compile time error
33. What is the output of this program?
#include <iostream>
using namespace std;
void square (int *x)
{
*x = (*x + 1) * (*x);
}
int main ( )
{
int num = 10;
square(&num);
cout << num;
return 0;
}
a) 100 b) compile time error c) 144 d) 110
34. What is the output of this program?
#include <iostream>
using namespace std;
int add(int a, int b);
int main()
{
int i = 5, j = 6;
cout << add(i, j) << endl;
return 0;
}
int add(int a, int b )
{
int sum = a + b;
a = 7;
return a + b;
}
a) 11 b) 12 c) 13 d) compile time error
35. What is the output of this program?
#include <iostream>
using namespace std;
void Sum(int a, int b, int & c)
{
a = b + c;
b = a + c;
c = a + b;
}
int main()
{
int x = 2, y =3;
Sum(x, y, y);
cout << x << " " << y;
return 0;
}
a) 2 3 b) 6 9 c) 2 15 d) compile time error
36. What is the new value of x?
#include <iostream>
using namespace std;
void fun(int &x)
{
x = 20;
}
int main()
{
int x = 10;
fun(x);
cout << "New value of x is " << x;
return 0;
}
a) 10 b) 20 c) 15 d) none of the mentioned
37. main()
{
int i=300;
char *ptr = &i;
*++ptr=2;
printf("%d",i);
}
A.555 B.556 C.551 D.554
38. main()
{
int i = 258;
int *iPtr = &i;
printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );
}
A.1 1 B.3 1 C.2 1 D.4 1
39. main()
{
int i = 257;
int *iPtr = &i;
printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );
}
A.1 1 B.1 2 C.3 1 D.4 1
40. main()
{
void swap();
int x=10,y=8;
swap(&x,&y);
printf("x=%d y=%d",x,y);
}
void swap(int *a, int *b)
{
*a ^= *b, *b ^= *a, *a ^= *b;
}
A.x=8 y=10 B.x=10 y=8 C.x=8 y=8 D.x=10 y=10

S-ar putea să vă placă și