Tuesday, 2 December 2014

      Systems Programming - Unix Quiz Question and Answers - Part 3



Question 1: Write a command for clearing  the screen.
Select one:
a. CTRL-D
b. erase
c. clear 
d. delete

Question 2: Give any two names of propiretary unix
Select one:
a. CP/M, TRDOS
b. Solaris, Mac 
c. DOS, WIndows
d. Xenix, Linux

Question 3: The grep command is used for sorting the content of a file on any of the fields in the data.
Select one:
True
False 

Question 4: find / -name '*' will
Select one:
a. List a file named * in /
b. List all files and directories in / directory
c. List all files and directories recursively starting from /
d. List all files in / directory 

Question 5: perl and awk are two names for the same programming language.
Select one:
True
False 

Question 6: Which command is used to set terminal IO characteristic?
Select one:
a. ctty
b. stty 
c. tty
d. ptty

Question 7: What is the difference between cd ~ ,cd .. ,cd . and cd /
Select one:
a.
cd .. will move you up one directory.
cd ~ will move you up one directory.
cd / takes you to absolute path
cd . will leave you in the same directory you are currently in.
b.
cd .. will leave you in the same directory you are currently in.
cd ~ Move to the user's home directory.
cd / takes you to absolute path
cd . will move you up one directory.
c.
cd .. will move you up one directory.
cd ~ Move to the user's home directory.
cd / takes you to absolute path
cd . will leave you in the same directory you are currently in 
d.
cd .. will move you up one directory.
cd ~ will move you up one directory.
cd / takes you to root
cd . will leave you in the same directory you are currently in.


Question 8: How will you connect output of one command to input to other command?
Select one:
a. command > command
b. command || command
c. command | command 
d. command pipe command

Question 9: A soft link does not have the same inode number as the original directory entry of the file which is being soft-linked.
Select one:
True 
False

Question 10:What is the purpose of "rb" in fopen() function used below in the code?
FILE *fp;
fp = fopen("source.txt", "rb");
Select one:
a. Create a new file "source.txt" for reading and writing
b. None of the stated options
c. open "source.txt" in binary mode for reading and writing
d. open "source.txt" in binary mode for reading 

Question 11: The following piece of awk code 
  BEGIN { x=3 }
  { print x, $x}
Select one:
a. Does not execute as it waits for the END {} instruction. 
b. It does not give any output.
c. prints two "fields" to standard out. The first field printed is the third field (or column) on the input line, the second field printed is the number "3".
d. prints two "fields" to standard out. The first field printed is the number "3", the second is the third field (or column) on the input line.
e. prints one "field" to standard out. It is the third field (or column) on the input line.

Question 12: AWK has an incredible useful feature which most computing languages lack. It is
Select one:
a. associative arrays 
b. object oriented
c. interpreted oriented.
d. procedural
e. it is a dynamic programming languages

Question 13: Which command is used to print a file
Select one:
a. lpr 
b. ptr
c. print
d. none of the given options

Question 14: What is the role of the kernel in UNIX?
Select one:
a. It handles the filestore and communications in response to system calls.
b. It allocates time and memory to programs and handles the filestore and communications in response to system calls.
c. It allocates memory to programs and handles communications in response to system calls. Incorrect
d. It allocates time and memory to programs.

Question 15: When you hard link a new directory entry is generated with the same inode number in the new entry as that in the old directory entry.
Select one:
True 
False

Question 16: Which command is used to display the operating system name
Select one:
a. uname 
b. myos
c. kernel
d. os

Question 17: The following piece of awk code 
  BEGIN { x=3 }
  { print x, $x}
Select one:
a. It does not give any output.
b. prints two "fields" to standard out. The first field printed is the third field (or column) on the input line, the second field printed is the number "3".
c. prints one "field" to standard out. It is the third field (or column) on the input line.
d. Does not execute as it waits for the END {} instruction. 
e. prints two "fields" to standard out. The first field printed is the number "3", the second is the third field (or column) on the input line.

Question 18:The command
cmp file1 file2 
indicated the line number and character number at which the two files file1 and file2 differ for the first time as you parse through both files.
Select one:
True 
False

Question 19: Which command is used to record a user login session in a file
Select one:
a. read
b. script 
c. none of the given choices
d. macro

Question 20:What does fp point to in the program ?
#include<stdio.h>
int main()
{
    FILE *fp;
    fp=fopen("trial", "r");
    return 0;
}
Select one:
a. The name of the file.
b. The first character in the file
c. The last character in the file.
d. A structure which contains a char pointer which points to the first character of a file.

Question 21: Which option of ls command used to view file inode number
Select one:
a. -a
b. -l
c. -o
d. -i 

Question 22: Write the difference between rm and mv command.
Select one:
a. rm remakes file, mv moves file.
b. rm removes file, mv moves file. 
c. rm renames file, mv makes variable.
d. rm renames file, mv makes variable.

Question 23: Write a command to display files with permissions, number of hard links, owner, group, size, date and filename.
Select one:
a. ls -a
b. ls -l 
c. ls -i
d. ls -o

Question 24: who | grep tulsi
will only show the details of the the user tulsi is she is logged in at the time this command is executed.
Select one:
True 
False

Question 25: The name awk comes from
Select one:
a. Aho, Kernighan and Weinberger 
b. a.w.k.jones, salty
c. awake my soul
d. awkward

            Systems Programming - Unix Quiz Question and Answers - Part 2


Question 1: Which command is used to copy all files having the string chap and any two characters after that to the progs directory?
Select one:
a. cp chap[12] /progs/*.*
b. cp chap?? progs 
c. None of the given answers
d. cp chap* progs
e. cp chap?? /progs/*

Question 2: In Linum the file /etc/passwd contains:
Select one:
a. Only password
b. Password, user id and group id only
c. The name of default shell and home directory besides other infomation.
d. Password and user id only.
e. all information about user rights Incorrect

Question 3: Xenix system is a property of 
Select one:
a. Linux Corporation
b. Lotus Corp
c. Sun
d. Microsoft 
e. IBM

Question 4: The command
wc section1.*
will only print the total lines, words, and characters for all files having the name starting with 'section1.' put together. The output appears in 1 line.
Select one:
True
False 

Question 5:If you use the ls command with the option -la
ls -la 
Select one:
a. lists files from archives
b. system and hidden files are also listed and the list is on long format 
c. All files are lists just list with -l option
d. lists the files in the order of last access
e. List the files in the order of least age

Question 6: Comment on the command given below:
man man
Select one:
a. This is a typing mistake.  Gives the same responce as typing once.
b. Returns and indication of error.
c. This is a typing mistake.  Should have been typed only once.
d. Only lists the options available under the man command.
e. Provides man details about man 

Question 7: Which of the following files contains information related to password aging?
Select one:
a. shodow
b. profile
c. password Incorrect
d. none of the given choices
e. all 3 given choices

Question 8: Holding the CONTROL key and pressing 'd' is equivalent to pressing the RETURN key.
Select one:
True
False 

Question 9: Which of these statements is true about the UNIX Kernel
Select one:
a. Provides service to user applications such as device management, process scheduling, etc.
b. None of the given statements.
c. Manages the entire resources of the system, presenting them to you and every other user as a coherent system. 
d. All 3 of the given statements. 
e. Loaded at system start up (boot). Memory-resident control program.

Question 10: Which of the following commands is used to copy a file wb from the programs directory into a file called wbx in the misc directory?
Select one:
a. cp programs/wb misc/wbx 
b. tar programs/wb misc/wbx
c. None of the given options
d. copy programs/wb misc/wbx
e. copy a:programs/wb b:misc/wbx

Question 11: UNIX uses the mv command to rename a file.
Select one:
True 
False

Question 12: The octal representation 652 indicates
Select one:
a. None of the given options.
b. Read and write permission of groups
c. Write permission for others 
d. Execute permission for the owner

Question 13: Special characters . (dot), .. (double dot) and ~ (tilde) are used in the path name.
Tilde stands for:
Select one:
a. User's home directory.
b. current directory
c. Root Directory Incorrect
d. default directory
e. Current Directory

Question 14: The Official Trademark of Unix is
Select one:
a. None of the given choices
b. All 3 of given choices
c. Unix
d. UNIX Correct
e. Linux

Question 15: Which of the following commands is used to rename a file?
Select one:
a. rn
b. rename
c. ren
d. mv 
e. remove

                  Systems Programming - Unix Quiz Question and Answers



Question 1: When you use the cp command in UNIX to copy a file, the file is not actually duplicated but only a new directory entry is generated to the same physical file. It is because of this that copying is sometimes called hard linking.
Select one:
True
False

Question 2: The command pwd is an acronym for Print Working Directory.
Select one:
True
False

Question 3
The who command only tells the name, type and login date and time of the current logged in user who is issuing this command.
Select one:
True
False

Question 4: The Linux Operating System consists of
Select one:
a. Only kernel
b. Utilities, drivers and libraries
c. Utilities and Libraries
d. shell, Kernel, Utilities, drivers and libraries 
e. Kernel, Utilities, drivers and libraries

Question 5: Which of the following is not a UNIX OS
Select one:
a. HP-UX
b. Ubuntu 
c. Sun Solairs
d. IBM AIX
e. Mac OS X

Question 6: When the command ls is types with option -li as
ls -li
the output will include
Select one:
a. Long file name with path
b. long format and inode number 
c. Show list in indexed order
d. None of the provided options
e. show values of large intergers

Question 7: Which of these is true about UNIX
Select one: 
a. Multiprocessing only
b. None of the given choices
c. Multiuser only
d. Mutlitasking only
e. All 3 of given choices 

Question 8: .profile file.  Which of these statements is not true about this file.
Select one:
a.The .profile file contains your individual profile that overrides the variables set in the /etc/profile file. 
b.The .profile file is never used to set exported environment variables and terminal modes. 
c. The .profile file is present in your home ($HOME) directory 
d. It lets you customize your individual working environment.
e. Because the .profile file is hidden, use the ls -a command to list it

Question 9: UNIX was originally developed  by a group of AT&T employees at Bell Labs in
Select one:
a. 1973
b. 1989
c. 1969 
d. 1979
e. Year 2K

Question 10: UNIX trademark is owned by
Select one:
a. Open Group 
b. Bell Labs
c. UNIX Corporation
d. IBM
e. AT&T


Sunday, 9 November 2014

Hello Friends,


Here are few videos which will help you to increase your brain power, this will really motivate you and help you to increase your concentration on Studies.























        "YOU MIGHT ALSO LIKE" Widget to Blogger.


Hi Friends,

Do you want the readers navigate to similar or related posts in your blog and you want to add a Widget to show them.

Here are the few quick steps which will help you to do that:


  • Now you need to fill your email ID and web URL on the Right side down as shown in below figure.
  • Click on the Get Widget! and you will be asked to click install Widget as shown below and click on Install Widget.
  • Once you click on install Widget , you will be redirected to Blogger page and follow the below instruction.
  • Select a blog if you have more than one, then click on Add Widget.
  • For better performance, Drag and Drop the LinkWithin box under the "Blog Posts" box and Click Save.


You are done, now the Widget will appear on your Blog.





Java Quiz Question and Answers - Part 9

                         Java Quiz Exam Oriented


Answers are marked with light yellow.

Question 1: interface can have only static variables.
Select one:
True 
False

Question 2: default is the default access specifiersin class and interface.
Select one:
True 
False

Question 3: notify() method is defined in Object class.
Select one:
True 
False

Question 4: In jdk1.7 and later, underscore characters "_" can appear anywhere between digits in a numerical literal.
Select one:
True 
False

Question 5: abstract class can have parameterized constructor.
Select one:
True 
False

Question 6: we can define individual anonymous class in java program .
Select one:
True
False 

Question 7: In StringBuffer class, equals() method checks the content.
Select one:
True
False 

Question 8: main() method can be overloaded.
Select one:
True 
False



Java Quiz Question and Answers - Part 8

                            Java Quiz Exam Oriented 

Answers are marked with light yellow.

Question 1: constructor can be declared as private.
Select one:
True 
False

Question 2: we can write constructor in interface .
Select one:
True
False

Question 3: Graphics is an abstract class.
Select one:
True 
False

Question 4: no need to import java.lang package explicitly in java program.
Select one:
True 
False

Question 5: Class is a predefined class in java.
Select one:
True 
False

Question 6: predefined class name can be used as variable name.
Select one:
True
False

Question 7: CheckBox is a predefined class.
Select one:
True
False

Question 8: private methods can't be overloaded.
Select one:
True
False

Question 9: Every method of a final class is implicitly final.
Select one:
True 
False

Java Quiz Question and Answers - Part 6

                       Java Quiz Exam Oriented



Question 1: A class Sample could have a member named sample.
Select one:
True
False

Question 2: we can represent floating point number in hexa decimal format.
Select one:
True
False

Question 3: we can represent floating point number in hexa decimal format.
Select one:
True
False

Question 4: we can implement operator overloading in java
Select one:
True
False

Question 5: Empty java file is valid.
Select one:

True
False


Question 6:  goto is a resreved word  in java
Select one:

True
False

Question 7: we can use unicode characters to write a program in java
Select one:

True
False


Question 8: At compilation time,java compiler import java.lang implicitly.
Select one:
True
False

Java Quiz Question and Answers - Part 7

                                Java Quiz Exam Oriented


Answers are marked with light yellow.

Question 1: It is possible to have two methods in the same class that have the same name, the same number and types of arguments, but different return types.
Select one:

True
False 


Question 2: The finally block is executed when an exception is thrown, even if no catch matches it.
Select one:

True 
False


Question 3: finalize() is a predefinedmethod
Select one:

True 
False


Question 4: An interface can inherit from multiple interface.
Select one:

True 
False


Question 5: The subclass exception should precede the base class exception when used within the catch block.
Select one:

True 
False


Question 6: package statement must be first statement in java program.
Select one:

True 
False


Question 7: sleep(int k) method throws checked exception.
Select one:

True 
False


Question 8: we can create an array with zero size.
Select one:

True 
False

Java Quiz Question and Answers - Part 5

                             Java Quiz Exam Oriented


Question 1: Out is a predefined instance variable of the type Printstream class.
Select one:
True
False


Question2: super keyword calls super class constructor.
Select one:

True
False


Question 3: + acts as polymorphic behavior in java
Select one:
True
False  


Question 4: if the class is declared as final,the class canot be extneded.
Select one:
True
False


Question 5: A package statement can occur either before or after import statements.
Select one:
True
False


Question 6: It is possible to have two methods in the same class that have the same name, the same number and types of arguments, but different return types.
Select one:
True
False


Question 7: In every constructor ,compiler will write super(), if super() is  not there.
Select one:
True
False


Question 8: Any class member except a constructor can be static.
Select one:
True
False



Java Quiz Question and Answers - Part 4

                       Java Quiz Exam Oriented


Question 1:  we can call static method with object name.
Select one:
True
False

Question 2: we can declare an int array without size.
Select one:
True
False

Question 3: Private methods can be  overridden in sub class
Select one:
True
False

Question 4: equals() is ovveriden in StringBuffer class.
Select one:
True
False

Question 5: && operator only applied to boolean operations.
Select one:
True
False

Question 6: A class cannot overload its constructors
Select one:
True
False  

Question 7: sub class object can access super class members including private members.
Select one:
True
False

Question 8: even no main  method ,your java program  will compile
Select one:
True
False

Question 9: default value for class type variable is NULL.
Select one:
True
False

Question 10: there is no constraint, having public classes in a java file.
Select one:
True
False



Java Quiz Question and Answers - Part 3

                          Java Quiz Exam Oriented

Question 1: Which of these is data type long literal?
Select one:
a. ABCDEFG
b. 99671246
c. 0x99fffa
d. 0x99fffL

Question 2: JIT stands for
Select one:
a. Java Interpreter Time
b. Just In Time
c. Just In Text  
d. Job In Time

Question 3:  You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?
Select one:
a. public
b. private
c. transient
d. protected

Question 4:  What is stored in the object obj in following lines of code?
                    box obj;
 Select one:
a. garbage
b. Any arbitrary pointer
c. Memory address of allocated memory of object.
d. null

Question 5: What is the output for the below code?
public class A {
int k;
boolean istrue;
static int p;
public void printValue() {
System.out.print(k);
System.out.print(istrue);
System.out.print(p);
}
}
public class Test{
public static void main(String argv[]){
A a = new A();
a.printValue();
}
}
Select one:

a. 0 0 0
b. Compile error ­ static variable must be initialized before use
c. 0 true 0
d. 0 false 0

Question 6:
we can't write constructor explicitly in the class.
Select one:

True
False

Question 7: Which four options describe the correct default values for array elements of the types indicated?
int -> 0
String ­-> "null"
Dog ­-> null
char ­-> '\u0000'
float ­-> 0.0f
boolean ­-> true
Select one:
a. 2, 4, 5, 6
b. 3, 4, 5, 6
c. 1, 3, 4, 5
d. 1, 2, 3, 4

Question 8: jvm is machine dependent.
Select one:
True
False

Question 9: Which of the following statements is correct?
Select one:
a. public method is accessible to all other classes in the hierarchy
b. public method is accessible only to subclasses of its parent class
c. public method can be accessed by calling object of the public class. Incorrect
d. public method can only be called by object of its class.

Continued...





Java Quiz Question and Answers - Part 2

                       Java Quiz Exam Oriented

 Answers are marked with light yellow.
Question 1: In a single java file, we can have _________ number of classes.
Select one:a. 3
b. 1
c. 4
d. any

Question 2: default is a keyword in java
Select one:
True
False

Question 3: Which of these statements is correct?
Select one:
a. true and false are non numeric values.
b. true and false are numeric values 0 and 1.
c. true is any non zero value and false is 0.
d. true and false are numeric values 1 and 0.

Question 4: Which of these statements are incorrect?
Select one:
a.
Assignment operators are more efficiently implemented by Java run­time system than their equivalent long forms.

b. Assignment operators can be used only with numeric and character data type. Incorrect
c. None
d. Assignment operators run faster than their equivalent long forms.

Question 5: Which of these statement is incorrect?
Select one:

a. Applets do not require a main() method at all.
b. Every class must contain a main() method.
c. There can be only one main() method in a program.
d. main() method must be made public.

Question 6: What is the range of data type short in Java?
Select one:

a. -128 to 127
b. -32768 to 32767
c. -2147483648 to 2147483647
d. None of the mentioned

Question 7: public class Test { }
During compilation, it generates default one argument constructor.
Select one:

True
False


Question 8:
which methods we can call with class name?
Select one:a. native
b. static
c. synchronized.
d. instance

Continued ...






Java Quiz Question and Answers - Part 1


                   Java Quiz Exam Oriented - Part 1

Let us see few Java Questions and the respective answers which will be asked frequently:

Answers are marked in light yellow.

Question 1: What is the output of this program?class main_class {
public static void main(String args[])
{
int x = 9;
if (x == 9) {
int x = 8;
System.out.println(x);
} } }Select one:
a. 8
b. compilation error
c. 9
d. runtime error

Question 2: Which of the following is a method having same name as that of it's class?
Select one:
a. delete
b. finalize
c. class
d. constructor 

Question 3: Which of these operators is used to allocate memory for an object?

Select One:
a. give
b. alloc
c. malloc
d. new

Question 4: Which three are valid declarations of a char?
1                   char c1 = 064770;2                   char c2 = 'face';3                   char c3 = 0xbeef;4                   char c4 = \u0022;5                   char c5 = '\iface';6                   char c6 = '\uface';
Select one:
a. 1, 3, 6
b. 5 only
c. 3, 5
d. 1, 2, 4

Question 5: Which of these lines of code will give better performance?
1.                a | 4 + c >> b & 7;
2.               (a | ((( 4 * c ) >> b ) & 7 ))Select one:
a. Dependent on the computer system.
b. 2 will give better performance as it has parentheses.
c. 1 will give better performance as it has no parentheses.
d. Both 1 & 2 will give equal performance.

Question 6: What is the output for the below code ?
public class Test {
public static void main(String[] args){
int i = 010;
int j = 07;
System.out.println(i);
System.out.println(j);
}
}Select one:
a. 8    7
b. 10   7
c. Compilation fails with an error at line 3
d. Compilation fails with an error at line 5

Question 7: Which of these selection statements test only for equality?
Select one:
a. switch
b. none of the mentioned
c. if
d. if and switch

Question 8: Which one of these lists contains only Java programming language keywords?
Select one:
a. class, if, void, long, Int, continue
b. goto, instanceof, native, finally, default, throws 
c. byte, break, assert, switch, include
d. try, virtual, throw, final, volatile, transient
e. strictfp, constant, super, implements, do

More Questions are available in series