You are on page 1of 8

VERNALIS SYSTEMS

TECHNICAL QUESTION SET 5

1. C programs are converted into machine language with the help of

A. An Editor B. A compiler C. An operating system D. None of these.

2. C was primarily developed as A. System programming language B. General purpose

language C. Data processing language D. None of the above.

3. Standard ANSI C recognizes ______ number of keywords?A. 30 B. 32 C. 24 D. 36 E. 40

4. Which one of the following is not a reserved keyword for C?A. auto B. case C. main D. default E.

register

5. A C variable cannot start with

A. A number B. A special symbol other than underscore C. Both of the above D. An alphabet

6. If the class name is X, what is the type of its “this” pointer (in a nonstatic, non-const member function)?a.

const X* const b. X* const c. X* d. X&

7. Which classes allow primitive types to be accessed as objects?a. Storage b. Virtual c. Friend

d. Wrapper

8. When is std::bad_alloc exception thrown?

a. When new operator cannot allocate memory

b. When alloc function fails

c. When type requested for new operation is considered bad,this exception is thrown

d. When delete operator cannot delete teh allocated (corrupted) object

9. Which one of the following is not a fundamental data type in C++

a. float b. string c. int d. wchar_t

10. Which of the following is a valid destructor of the class name "Country"

a. int ~Country() b. void Country() c. int ~Country(Country obj) d. void ~Country()

11. 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

12. 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

13. Count function in SQL returns the number of

A) Values B) Distinct values C) Groups D) Columns

14. Composite key is made up of ................A) One column B) One super key C) One foreign key D)

Two or more columns

15. What command is used to get back the privileges offered by the GRANT command?

A) Grant B) Revoke C) Execute D) Run

16.A webpage displays a picture. What tag was used to display that picture?

a. picture b. image c. img d. src

17. <b> tag makes the enclosed text bold. What is other tag to make text bold?

a. <strong> b. <dar> c. <black> d. <emp>

18. Tags and test that are not directly displayed on the page are written in _____ section.

a. <html> b. <head> c. <title> d. <body>

19. What does vlink attribute mean?a. visited link b. virtual link c. very good link d. active link

20. Which attribute is used to name an element uniquely?a. class b. id c. dot d.

all of above

21. In Java variables, if first increment of the variable takes place and then the assignment occurs. This

operation is also called............................A) pre increment B) post increment C) incrementation D)

pre incrementation

22. When the operators are having the same priority, they are evaluated from................. ............. in the

order they appear in the expression. A) right to left B) left to right C) any of the order

D) depends on compiler

23. In java, can only test for equality, where as ............ can evaluate any type of the Boolean expression.

A) switch, if B) if, switch C) if, break D) continue, if

24. The...................... looks only for a match between the value of the expression and one of its case

constants.
A) if B) match C) switch D) None of the above

25. System.in.read () is being used, the program must specify the .................. clause.

A) throws.java.out.IOException B)throws.java.in.IOException

C) throws.java.io.IOException D)throws.java.io.InException

PREDICT THE OUTPUT

26. What is the output of this C code?

#include <stdio.h>

int main()

{ int a = 10;

double b = 5.6;

int c;

c = a + b;

printf("%d", c);

} a) 15 b) 16 c) 15.6 d) 10

27. What is the output of this C code?

#include <stdio.h>

void main()

{ int a = 3;

int b = ++a + a++ + --a;

printf("Value of b is %d", b); }

a) Value of x is 12 b) Value of x is 13 c) Value of x is 10 d) Undefined behaviour

28. Comment on the output of this C code?

#include <stdio.h>

struct temp

{ int a;

int b;

int c; };

main()
{ struct temp p[] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; }

a) No Compile time error, generates an array of structure of size 3

b) No Compile time error, generates an array of structure of size 9

c) Compile time error, illegal declaration of a multidimensional array

d) Compile time error, illegal assignment to members of structure

29. What is the output of this C code? (Assuming size of int be 4)

#include <stdio.h>

struct temp

{ int a;

int b;

int c; } p[] = {0};

main()

{ printf("%d", sizeof(p)); }

a) 4 b) 12 c) 16 d) Can’t be estimated due to ambigous initialization of array

30. What is the output of this C code?

#include <stdio.h>

struct student

{ char *name; };

struct student s[2];

void main()

{ s[0].name = "alan";

s[1] = s[0];

printf("%s%s", s[0].name, s[1].name);

s[1].name = "turing";

printf("%s%s", s[0].name, s[1].name); }

a) alan alan alan turing b) alan alan turing turing c) alan turing alan turing d) Run time error

31. Determine output:

class A{
public static void main(String args[]){

int x;

x = 10;

if(x == 10){

int y = 20;

System.out.print("x and y: "+ x + " " + y);

y = x*2; }

y = 100;

System.out.print("x and y: " + x + " " + y); } }

A. 10 20 10 100 B. 10 20 10 20 C. 10 20 10 10 D. Error

32. What is the output of the following program?

class A{

public static void main(String args[]){

byte b;

int i = 258;

double d = 325.59;

b = (byte) i;

System.out.print(b);

i = (int) d;

System.out.print(i);

b = (byte) d;

System.out.print(b); } }

A. 258 325 325 B. 258 326 326 C. 2 325 69 D. Error

33. Determine output:

public class Test {

static void test(float x){

System.out.print("float"); }

static void test(double x){


System.out.print("double"); }

public static void main(String[] args){

test(99.9); } }

A. float B. double C. Compilation Error D. Exception is thrown at runtime

34. The following fraction of code

double STATIC = 2.5 ;

System.out.println( STATIC );

A. Prints 2.5 B. Rraises an error as STATIC is used as a variable which is a keyword

C. Raises an exception D. None of these

35. What would be the output of the following fraction of code ?

int Integer = 34 ;

char String = 'S' ;

System.out.print( Integer ) ;

System.out.print( String ) ;

A. Does not compile as Integer and String are API class names. B. Throws exception. C. 34 D. S E.

34 S

36. What is the output of the following program?

public class Test{

static int x = 10 ;

public static void main(String[] a){

Test test = new Test( ) ;

Test test1 = new Test( ) ;

test.x += 1 ;

System.out.println( test.x + test1.x ) ; }}

A. 20 B. 21 C. 22 D. Compilation Error E. Throws Exception

37. What is the output of this C code?

#include <stdio.h>

struct student
{

char *name;

};

struct student s[2], r[2];

void main()

s[0].name = "alan";

s[1] = s[0];

r = s;

printf("%s%s", r[0].name, r[1].name);

} a) alan alan b) Compile time error c) Varies d) Nothing

38. What is the output of this C code? #include <stdio.h>

struct student

char *name;

};

void main()

struct student s[2], r[2];

s[1] = s[0] = "alan";

printf("%s%s", s[0].name, s[1].name);

a) alan alan b) Nothing c) Compile time error d) Varies

39. What is the output of this C code?

#include <stdio.h>

struct student

{ };

void main()
{ struct student s[2];

printf("%d", sizeof(s)); }

a) 2 b) 4 c) 8 d) 0

40. What is the output of this C code if there is no error in stream fp?

#include <stdio.h>

int main()

FILE *fp;

fp = fopen("newfile", "w");

printf("%d\n", ferror(fp));

return 0;

a) Compilation error b) 0 c) 1 d) Any nonzero value