Programming Languages Fundamentals Quiz
A quiz covering fundamental concepts in multiple programming languages including Java, C#, and Visual Basic. Tests knowledge of data types, operators, keywords, compilation rules, and language-specific features.
Questions
Which of these is used to open an database?
- Set dbMyDB = OpenDatabase
- Set dbMyDB = OpenDatabase("MyDatabase.mdb")
- dbMyDB = OpenDatabase("MyDatabase.mdb")
- None of these
On start up, which of these window is not displayed?
- The Class window
- The Project window
- The Properties window
- The Blank Form window
Which of these is not an collection of the VB project?
- The object module
- The class module
- The form module
- The global module
Visual Basic uses an object called ______ to hold your table?
- file
- Record
- table
- RecordSet
What will be printed out if this code is run with the following command line? java myprog good morning public class myprog{ public static void main(String argv[]) { System.out.println(argv[2]); } }
- myprog
- good
- morning
- Exception raised: "java.lang.ArrayIndexOutOfBoundsException: 2"
A byte can be of what size
- -128 to 127
- (-2 power 8 )-1 to 2 power 8
- -255 to 256
- depends on the particular implementation of the Java Virtual machine
What data will be printed out if you attempt to compile and run the following code(ignore newline in output)? int i=1; switch (i) { case 0: System.out.println("zero"); break; case 1: System.out.println("one"); case 2: System.out.println("two"); default: System.out.println("default"); }
- one
- one default
- one two default
- default
Which of the following will output -4.0
- System.out.println(Math.floor(-4.7));
- System.out.println(Math.round(-4.7));
- System.out.println(Math.ceil(-4.7));
- System.out.println(Math.min(-4.7));
What is the result of the following operation? System.out.println(4 | 3);
- 6
- 0
- 1
- 7
Which of the following lines will compile without warning or error.
- float f=2.3;
- char c="z";
- boolean b=null;
- int i=21;
- byte b=257;
Which of the following will throw an error while compilation 1) import java.awt.; package Mypackage; class Myclass {} 2) package MyPackage; import java.awt.; class MyClass{} 3) /*This is a comment / package MyPackage; import java.awt.; class MyClass{}
- Option 1
- Option 2
- Option 1 & 2
- Option 3
- Option 2 & 3
What will happen if you try to compile and run the following code public class MyClass { public static void main(String arguments[]) { amethod(arguments); } public void amethod(String[] arguments) { System.out.println(arguments); System.out.println(arguments[1]); } }
- error method main not correct
- error Can't make static reference to void a method.
- error array must include parameter
- a method must be declared with String
If you wanted to find out where the position of the letter v (ie return 2) in the string s containing "Java", which of the following could you use?
- mid(2,s);
- charAt(2);
- s.indexOf('v');
- indexOf(s,'v');
Which of the following is not a keyword or reserved word in Java?
- if
- then
- goto
- while
- case
if(check4Biz(storeNum) != null) {} Referring to the above, what datatype could be returned by method check4Biz()?
- Boolean
- int
- char
- float
Which of the following lines will compile without warning or error.
- float f=1.3;
- char c="a";
- int i=10;
- boolean b=null;
A byte can be of what size
- -128 to 127
- (-2 power 8 )-1 to 2 power 8
- -255 to 256
- 8
Which of the following are keywords or reserved words in Java?
- if
- then
- goto
- while
System.out.println(4 | 3);
- 6
- 0
- 1
- 7
What is the size for double data type in c#
- 1 Byte
- 2 Byte
- 4 Byte
- 8 Byte
- 16 Byte