IBM Interview Questions and Answers

IBM Interview Questions and Answers
1 Draw a flowchart to find a number from an array.
2. What is vector processing Subscribe
Ans:A vector processor, or array processor, is a CPU design that is able to run mathematical operations on a large number of data elements very quickly. This is in contrast to a scalar processor which handles one element at a time – the vast majority of CPUs are scalar (or close to it)

3. Best sorting if elements are already sorted Subscribe
Ans:insertion sort is the best sort when the list is already sorted as the no of comparision reduces its complexity is n.quick sort is best when the pivot variable is in the middle of the list

4. Insertion sortSoftware configuration management

5.x-=y+1 is equivalent to..
x=x-y-1 because it is interpreted as x=x-(y+1)


6. What happens when we open a file in r+ mode Subscribe
- 'r+' opens the file for both reading and writing.
- 'r' should be used when the file will only be read.

7. If you get error in adapter which device will u use?

8. If you type in the command nohup sort employees > list 2 > error out & and log off ,the next timeIf you type in the command nohup sort employees > list 2 > error out & and log off ,the next time you log in . the output will be
a). in a file called list and the error will de typed in a file error out
b). there will be no file called list or error out
c). error will be logged in a file called list and o/p will be in error out
d). you will not be allowed to log in
e).none of the above
Ans: nohup is a Unix command that is used to run another command while suppressing the action of the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out. It is most often used to run commands in background as daemons. Output that would normally go to the terminal goes to a file called nohup.out if it has not already been redirected.
ans (a) chk it

9. In UNIX, What is files i-node
Ans:It is a data structure that defines all specifications of a file like the file size ,number of lines to a file ,permissions etc.

10. The UNIX shell is....

a).does not come with the rest of the system
b).forms the interface between the user and kernel
c) does not give any scope for programming
d) does not allow calling one program from with in another
e) all of the above
Ans b
11 The command
grep first second third /usr/you/myfile

a) prints lines containing the words first, second or third from the file /usr/you/myfile
b) searches for lines containing the pattern first in the files
second, third, and /usr/you/myfile and prints them
c) searches the files /usr/you/myfiel and third for lines containing
the words first or second and prints them
d) replaces the word first with the word second in the files third and /usr/you/myfile
e) None of the above
Ans) b
Q)class xx{
int getseg();
private:
int segDet;
};
this class may create problem because: reasons are..


Ans: becoa getseg class is private.
Q)What is fork()?
Ans: fork() is a function that is used to create a child process from a parent process.
Q)What are the files in /etc directory?.
Ans: configuration files.
Example: /etc/lilo.conf, /etc/fstab , /etc/mtab , /etc/resolve.conf , /etc/profile, /etc/host.conf etc.
Q) What does the following statement mean?
int (*a)[4]

A. 'a' is a pointer to an array of 4 integers
B. 'a' is an array of pointers to integer
C. 'a' is a pointer to function returning an intege

Q)Which is not is not overloaded?
Ans:The only C operators that can't be are . and ?: (and sizeof, which is technically an operator). C++ adds a few of its own operators, most of which can be overloaded except :: and .*.
12 The redirection operators > and >>

a) do the same function
b) differ : > overwrites, while >> appends
c) differ : > is used for input while >> is used for output
d) differ : > write to any file while >> write only to standard output
e) None of these
Ans) b
Q)Read all the Below topics
1 What is the difference between OOP (Object Oriented Programming) and POP (Procedure Oriented Programming).
2 Example of Polymorphism.
3 Why paging, segmentation needed.
4 What is ADT (Abstract Data Type)?
Q)ARP is used for...........
A. map from MAC address to IP add.
B. map from IP addresses to MAC add.
C. to store the IP addresses.
Ans:b

Q) Which of the following API is used to hide a window
a) ShowWindow
b) EnableWindow
c) MoveWindow
d) SetWindowPlacement
e)None of the above
Ans:a
Q) what is pragma exception???
Ans:- Associating a PL/SQL Exception with a Number: Pragma EXCEPTION_INIT
To handle error conditions (typically ORA- messages) that have no predefined name, you must use the OTHERS handler or the pragma EXCEPTION_INIT. A pragma is a compiler directive that is processed at compile time, not at run time.In PL/SQL, the pragma EXCEPTION_INIT tells the compiler to associate an exception name with an Oracle error number. That lets you refer to any internal exception by name and to write a specific handler for it. When you see an error stack, or sequence of error messages, the one on top is the one that you can trap and handle.You code the pragma EXCEPTION_INIT in the declarative part of a PL/SQL block, subprogram, or package using the syntaxPRAGMA EXCEPTION_INIT(exception_name, -Oracle_error_number);where exception_name is the name of a previously declared exception and the number is a negative value corresponding to an ORA- error number. The pragma must appear somewhere after the exception declaration in the same declarative section, as shown in the following example:
DECLARE
deadlock_detected EXCEPTION;
PRAGMA EXCEPTION_INIT(deadlock_detected, -60);
BEGIN
... -- Some operation that causes an ORA-00060 error
EXCEPTION
WHEN deadlock_detected THEN
-- handle the error
END;
Q)Function entry for DLL in win3.1
Ans: WinMain

Q)What type of memory could be accessed in least time?
Ans:CPU registers. The top of the memory pyramid :)
Q)what is data integrity constants?
Ans Oracle uses integrity constraints to prevent invalid data entry into the database. It can be achieved using NOTNULL, Primary Key ,CHECK, Foreign Key etc..... constraints
Q)Paging is ------------------------
Ans:
Paging is the technique of accessing memory ,larger than the maximum memory which can be addressed by a microprocessor.The interfaced memory is divided into pages such that the size of each page is equal to or less then the maximum memory which can be interfaced. Then whenever a specific address is to be accessed, the corresponding page is selected and the memory location is accessed.
Q) What is trigger in DBMS?
Ans:A Trigger is a PL/SQL block that executes whenever a particular event takes place.events in database like Insert,Update, Delete and combination of these three will cause the trigger to execute.Trigger is a technique to maintain integrity constraints
Q)What is the difference b/w 0123 and 123 in c?
Ans:0123 the number that can be start 0 it will be treated as a octal number that is base 8. 123 is the integer number representation base is 10.
Q) Nice command is used for?
ANS: This is used for change the priority
13 Which of the choices is true for the mentioned declaration ?
const char *p;
and
char * const p;
a) You can't change the character in both
b) First : You can't change the characterr &
Second : You can;t change the pointer
c) You can't change the pointer in both
d) First : You can't change the pointer &
Second : You can't chanage the character
e) None
Ans) b ( check it)
14) The standard source for standard input , standard output and standard error is
a) the terminal
b) /dev/null
c) /usr/you/input, /usr/you/output/, /usr/you/error respectively
d) NOne
Ans) a
Q The very first process created by the kernal that runs
till the kernal process is haltes is

a)init
b)getty
c)
d)
e)none
(Ans is a)
15)which function is the entry point for a DLL in MS Windows 3.1
a) main
b) Winmain
c) Dllmain
d) Libmain
e) None
Ans) b
16)which of the following function is used to repaint a window immediately
a) Sendmessage(hWnd,WM_PAINt,......)
b) InvalidateRect(.......)
c) MoveWindow
d) WM_COPY
e) None
Ans e
17What will be result of the following program?
void myalloc(char *x, int n)
{
x= (char *)malloc(n*sizeof(char));
memset(x,\0,n*sizeof(char));
}
main()
{
char *g="String";
myalloc(g,20);
strcpy(g,"Oldstring");
printf("The string is %s",g);
}
a) The string is : String
b) Run time error/Core dump
c) The string is : Oldstring
d) Syntax error during compilation
e) None of these
Ans) c ( check it )

No comments: