1) Which of the following is not true about C Programming?
C provides function oriented programming
C program can be compiled on a C++ compiler
C supports encapsulation is false. Only C++ supports encapsulation
2) What will be effect of sizeof operator on Unions?
gives the size of the biggest member
gives the size of sum of all members
gives the size of the smallest of the members
Correct Answer: gives the size of the biggest member
3) Divide by Zero is a common exception of type
can be either Run time or Compile time
Answer: Run Time
4) Find the output of the code snippet
char *S1 = "ABCD";
char S2[ ] = "ABC";
Output: 4,4. S1 is a character pointer giving the size of the pointer variable. Second one is a character array
with size 4. (Including the terminating character '\0').
5) Find the output of the code snippet
int i ;
int v = scanf("%d",&i); // Lets say the input is 23
Output = 1;
This is because, scanf reads and input and returns the number of items read. Hence 23 would be stored in i and 1
would be stored in v
6) What is the default size of a integer variable ?
a) 2 bytes
b) 4 bytes
c) can be 2 or 4 depending on the operating system
can be 2 or 4 depending on the operating system
7) Which of the following statements is false?
a)Pointers are designed for storing memory addresses
b)Arrays are passed by value to functions
c)Both of the above are false
Answer: Both of the above are false
8) Which of the following statements is true regarding static variables?
a) Which of the following statements is true regarding static variables?
b) Only local variables can be defined as static variables
c) Scope and life of global variables is limited to the function to which they are declared
Answer: Both local and global variables can be defined as static variables
9) An ampersand in front of a pointer variable gives
a) address of the value
b) value present at the address
c) depends on the actual scenario
Answer: a) Address of the value
10) Which of the following is not true about C Programming?
a)C provides function oriented programming
b)C program can be compiled on a C++ compiler
c)C supports encapsulation
Answer is C supports encapsulation
11) What will be effect of sizeof operator on Unions?
a) gives the size of the biggest member
b)gives the size of sum of all members
c)gives the size of the smallest of the members
Answer is gives the size of sum of all members
12) Divide by Zero is a common exception of type
c)can be either Run time or Compile time
Answer is Runtime
13)Find the output of the code snippet
char *S1 = "ABCD";
char S2[ ] = "ABC";
Answer is 4,4
14) What are identifiers and what is naming convention?
Ans : Identifiers are used for class names, method names and variable names. An identifier may be any descriptive sequence of upper case & lower case letters,numbers or underscore or dollar sign and must not begin with numbers.
15) What is the return type of program’s main( ) method?
Ans : void
16) What is the use of bin and lib in JDK?
Ans : Bin contains all tools such as javac, applet viewer, awt tool etc., whereas Lib contains all packages and variables.
17) The Java source code can be created in a Notepad editor.
18) The Java interpreter is used for the execution of the source code.
19) What declarations are required for every Java application?
Ans: A class and the main( ) method declarations.
20) What are the two parts in executing a Java program and their purposes?
Ans: Two parts in executing a Java program are:
Java Compiler and Java Interpreter.
The Java Compiler is used for compilation and the Java Interpreter is used for execution of the application.
21) What are the three OOPs principles and define them?
Ans : Encapsulation, Inheritance and Polymorphism are the three OOPs Principles.
Is the Mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse.
Is the process by which one object acquires the properties of another object.
Is a feature that allows one interface to be used for a general class of actions.
Disclaimer: Users of techforum4u.com are responsible for ensuring that any material they post (article, blog posts, images or other mulitimedia content) does not violate or infringe upon the copyright, patent, trademark, or any personal or proprietary rights of any third party, and is posted with the permission of the owner of such rights.Anyone who violates these rules may have their access privileges removed without warning.