C++ and Java Programming Fundamentals

Test your knowledge of fundamental programming concepts in C++ and Java, including operators, data types, pointers, arrays, and language-specific features.

16 Questions Published

Questions

Question 1 Multiple Choice (Multiple Answers)

What is the difference between Synchronous and Asynchronous updates?

  1. In synchronous processing, the program waits: control returns to the program only when the task has been completed
  2. In asynchronous processing, the program does not wait: the system returns control after merely logging the request for execution
  3. In asynchronous processing, the program waits: control returns to the program only when the task has been completed
  4. In synchronous processing, the program does not wait: the system returns control after merely logging the request for execution
Question 2 Multiple Choice (Single Answer)

Which of the following lines will compile without warning or error

  1. float f=1.3;
  2. int i=10;
  3. char c="a";
  4. byte b=257;
  5. boolean b=null;
Question 3 Multiple Choice (Single Answer)

A byte can be of what size

  1. -128 to 127
  2. (-2 power 8 )-1 to 2 power 8
  3. -255 to 256
  4. depends on the particular implementation of the Java Virtual machine
Question 4 Multiple Choice (Single Answer)

Which of the following are keywords or reserved words in Java?

  1. if
  2. then
  3. goto
  4. while
Question 5 Multiple Choice (Single Answer)

What will happen if you try to compile and run the following code? public class Q { public static void main(String argv[]){ int anar[]=new int[5]; System.out.println(anar[0]); } }

  1. Error: anar is referenced before it is initialized
  2. null
  3. 0
  4. 5
Question 6 Multiple Choice (Single Answer)

Which of the following most closely describes a bitset collection?

  1. A class that contains groups of unique sequences of bits
  2. A method for flipping individual bits in instance of a primitive type
  3. An array of boolean primitives that indicate zeros or ones
  4. A collection for storing bits as on-off information, like a vector of bits
Question 7 Multiple Choice (Single Answer)

Is C++ case sensitive?

  1. No
  2. Case sensitivity is compiler-determined
  3. Yes
  4. Don't Know
Question 8 Multiple Choice (Single Answer)

What does the code "cout<<(0==0);" print?

  1. 0
  2. 1
  3. Compiler error: Lvalue required
  4. Don't Know
Question 9 Multiple Choice (Single Answer)

If the program completes executing successfully, what value should the function main() return?

  1. 0
  2. 1
  3. void
  4. Don't Know
Question 10 Multiple Choice (Single Answer)

In which header file is isalpha() declared?

  1. conio.h
  2. stdio.h
  3. ctype.h
  4. stdlib.h
Question 11 Multiple Choice (Single Answer)

What will happen when the following code is run: int x; while(x<100) { cout<<x; x++; }

  1. The computer will output "0123...99"
  2. The computer will output "0123...100"
  3. The output is undefined
  4. Don't know
Question 12 Multiple Choice (Single Answer)

What does the following code output? void afunction(int *x) { x=new int; *x=12; } int main() { int v=10; afunction(&v); cout<<v; }

  1. Outputs 12
  2. Outputs 10
  3. Outputs the address of v
  4. Compile error
Question 13 Multiple Choice (Single Answer)

What is the outcome of the line of code "cout<<abs(-16.5);"?

  1. 16
  2. 17
  3. 16.5
  4. Error
Question 14 Multiple Choice (Single Answer)

What value will "strcmp("Astring", "Astring");" return?

  1. A positive value
  2. A negative value
  3. Zero
  4. Compile Error
Question 15 Multiple Choice (Single Answer)

Evaluate !(1&&1||1&&0)

  1. Error
  2. True
  3. False
  4. Can't Say
Question 16 Multiple Choice (Single Answer)

What header file is needed for the function exit()?

  1. stdlib.h
  2. conio.h
  3. dos.h
  4. ctype.h