Quiz
paper final
Este quiz tem tempo limite, por isso abre no player de sempre.
Perguntas do quiz (40)
1 Comment on the output of this C code?
#include <stdio.h>
int main()
{
int a[5] = {1, 2, 3, 4, 5};
int i;
for (i = 0; i < 5; i++)
if ((char)a[i] == '5')
printf("%d\n", a[i]);
else
printf("FAIL\n");
}- AThe compiler will flag an error
- BProgram will compile and print the output 5
- CProgram will compile and print the ASCII value of 5
- DProgram will compile and print FAIL for 5 times
2The following code ‘for(;;)’ represents an infinite loop. It can be terminated by.
- Abreak
- Bexit(0)
- Cabort()
- Dall of the mentioned
3 Which directory the compiler first looks for the file when using #include ?
- ACurrent directory where program is saved
- BC:COMPILERINCLUDE
- CS:SOURCEHEADERS
- DBoth C:COMPILERINCLUDE and S:SOURCEHEADERS simultaneously
4Which of the following statements are true?
P. Pointer to Array
Q. Multi-dimensional array- AP are static, Q are static
- BP are static, Q are dynamic
- CP are dynamic, Q are static
- DP are dynamic, Q are dynamic
5 Which of the following can be used for random number generation?
- Arandom()
- Brnd()
- Crndm()
- Dnone of the mentioned
6What is the output of this C code?
#include <stdio.h>
int main()
{
int i = 10, j = 3;
printf("%d %d %d", i, j);
}- ACompile time error
- B10 3
- C10 3 some garbage value
- DUndefined behaviour
7How many primitive data types are there in Java?
- A6
- B8
- C7
- D9
8Determine 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);
}
}- A10 20 100 10
- B20 10 10 20
- C10 20 20 10
- D10 20 10 10
9.
In Java, the word true is ................- AA Java keyword
- BA Boolean literal
- CSame as value 1
Same as value 1
Same as value 1 - Dsame as value 0
10Which of the following is used to interpret and execute Java Applet Classes hosted by HTML.
- A0
- B1
- C2
- D3
11What is the output of this C code?
#include <stdio.h>
void main()
{
int k = 8;
int x = 0 == 1 && k++;
printf("%d%d\n", x, k);
}- A0 9
- B0 8
- C1 9
- D1 8
12. Which of the following is a storage specifier?
- Aenum
- Bunion
- Cauto
- Dvolatile
13Which of the following are legal lines of Java code?
1. int w = (int)888.8;
2. byte x = (byte)100L;
3. long y = (byte)100;
4. byte z = (byte)100L;- A1,2
- B2,3
- C3,4
- Dall the above
14Which of the following classes can catch all exceptions which cannot be caught?
- ARuntimeException
- BError
- CException
- DParentException
15 What will be the value of d in the following program?
#include <stdio.h>
int main()
{
int a = 10, b = 5, c = 5;
int d;
d = b + c == a;
printf("%d", d);
}- Asyntax error
- B1
- C5
- D10
16 What is the output of this program?
class A
{
int i;
void display()
{
System.out.println(i);
}
}
class B extends A
{
int j;
void display()
{
System.out.println(j);
}
}
class inheritance_demo
{
public static void main(String args[])
{
B obj = new B();
obj.i=1;
obj.j=2;
obj.display();
}
}- A0
- B1
- C2
- Dcompilation error
17What is the output of this C code?
#include <stdio.h>
int main()
{
int x = 2, y = 2;
float f = y + x /= x / y;
printf("%d %f\n", x, f);
return 0;
}- A2 4.000000
- BCompile time error
- C2 3.500000
- DUndefined behaviour
18 Which of these are selection statements in Java?
- Aif()
- Bfor()
- Cbreak
- Dcontinue
19What is the output of this program?
import java.util.*;
class Bitset
{
public static void main(String args[])
{
BitSet obj = new BitSet(5);
for (int i = 0; i < 5; ++i)
obj.set(i);
obj.clear(2);
System.out.print(obj);
}
}- A{0, 1, 3, 4}
- B{0, 1, 2, 4}
- C{0, 1, 2, 3, 4}
- D{0, 0, 0, 3, 4}
20Which of these is long data type literal?
- A0x99fffL
- BABCDEFG
- C0x99fffa
- D99671246
21
A bag contains 2 red, 3 green and 2 blue balls. Two balls are drawn at random. What is the probability that none of the balls drawn is blue?- A10/21
- B11/21
- C21/23
- D10/11
22
If log 27 = 1.431, then the value of log 9 is:- A0.956
- B0.954
- C0.932
- D0.978
23
Find the average of first 97 natural numbers.- A31
- B38
- C45
- D49
24331, 482, 551, 263, 383, 362, 284
find odd man out- A482
- B331
- C383
- D362
25quick sort is solved by
- Adynamic programming
- BBacktracking
- Cdivide and conquer
- Dgreedy method
26 What will happen if two thread of same priority are called to be processed simultaneously?
- AAny one will be executed first lexographically
- BBoth of them will be executed simultaneously
- CNone of them will be executed
- DIt is dependent on the operating system
27 What is the string contained in s after following lines of code?
StringBuffer s new StringBuffer(“Hello”);
s.deleteCharAt(0);- Aello
- Bhello
- Chell
- Dllo
28 What would be the size of the following union declaration?
#include <stdio.h>
union uTemp
{
double a;
int b[10];
char c;
}u;- A8
- B4
- C80
- D40
29
If the price of the commodity is increased by 50% by what fraction must its consumption be reduced so as to keep the same expenditure on its consumption?- A1/2
- B1/3
- C1/4
- D2/3
30
A father said to his son, "I was as old as you are at the present at the time of your birth". If the father's age is 38 years now, the son's age five years back was:- A14
- B13
- C23
- D24
31. Which of these is a process of converting a simple data type into a class?
- Atype wrapping
- Btype conversion
- Ctype casting
- Dnone of the Mentioned.
32 What is the output of this program?
class Output
{
public static void main(String args[])
{
Double i = new Double(257.5);
Double x = i.MAX_VALUE;
System.out.print(x);
}
}- A0
- B1.7976931348623157E308
- C1.7976931348623157E30
- DNone of the mentioned
33What is the output of this C code(size of int and float is 4)?
#include <stdio.h>
union
{
int ival;
float fval;
} u;
void main()
{
printf("%d", sizeof(u));
}- A16
- B8
- C4
- D32
34Which among the following is never possible as an output for float?
- A3.666666
- B3.666
- C3
- DNone of the mentioned
35functions can return structure in c?
- Atrue
- Bfalse
- CDepends on the compiler
- DDepends on the standard
- Enone of the above
36A rectangular park 60 m long and 40 m wide has two concrete crossroads running in the middle of the park and rest of the park has been used as a lawn. If the area of the lawn is 2109 sq. m, then what is the width of the road?
- A2.91 m
- B3 m
- C5.82
- Dnone of these
37 Identify the correct sentence regarding inequality between reference and pointer.
- Awe can not create the array of reference
- Bwe can create the Array of reference
- Cwe can use reference to reference
- Dnone of the mentioned
38Which header is need to be used with function objects?
- A<function>
- B<functional>
- C<funct>
- D<functionstream>
39Which of these method of class StringBuffer is used to extract a substring from a String object?
- Asubstring()
- BSubstring()
- CSubString()
- DNone of the mentioned
40Which other keywords are also used to declare the class other than class?
- Astruct
- Bunion
- Cobject
- Dboth struct and union
Informações
- Descrição
- Computer Science Quiz sobre paper final, criado por rahul errabelly em 10-02-2018.
- Autor
- rahul errabelly
- Idioma
- English
- Visualizações
- 0
- Histórico
- Criado em 10 fev 2018 · atualizado em 11 fev 2018
- Etiquetas
- Avaliação
- Ainda sem avaliações Avalie este quiz