LInux QP
LInux QP
Q. No. 1
union xyz
{
int num;
char ch;
float bal;
};
int main()
{
union xyz var1;
printf("%d", sizeof(var1));
}
what will be output?
A:9 B:4 C:6 D:10
Difficulty level: Easy
Q. No. 2
int main( )
{
char *ptr;
printf(“%d”, sizeof(ptr));
}
What will be output?
A:4 B:0 C:1 D: none of above
Difficulty Level: Intermediate
Q. No. 3
int main()
{
enum color{WHITE=0, RED=5, GREEN, BLUE};
printf("%d", BLUE);
}
What will be output?
A: 5 B: 6
C: 7 D: 0
Difficulty Level: Easy
Q. No. 4
int main() {
int var1 = -10;
var1 = ! var1;
printf(“%d”, var1);
}
what will be output?
A: 1 B: 10
C: -10 D: 0
Difficulty Level: Intermediate
Q. No. 5
int main( )
{
int j ;
for( j = 2; ++j < 5 ; printf(“%d”, j)
}
What will be output?
A. 3 4 5 B. 2 3 4 5
C. 3 4 D. 3 4 5
Difficulty Level : Easy
Q. No. 6
item ob1(10), ob2; // line 1
ob2(ob1); // line2
where ob1 and ob2 are object of class item.
above mention line 2 is the case of _____________ .
A:constructor
B:copy constructor
C:overloaded assignment operator
D:overloaded function call operator
Difficulty Level : Difficult
Q. No. 7
Which one is correct for constructor.
Q. No. 8
A class is __________ .
a) blueprint for object
b) Abstract Data type
c) encapsulation of data and methods
d) all of the above
Difficulty Level : Intermediate
Q. No. 9
In OOPs reusability can be achieved through __________ .
A: Association B: Inheritance
C: Polymorphism D: all of the above
Difficulty Level : Easy
Q. No. 10
Inheritance is _______________.
A: same as encapsulation.
B: Aggregation of information.
Advance Computing Training School, C-DAC, Copyright © C-DAC, ACTS
Page 4 of 11
ACTS, C-DAC
Q. No. 11
Runtime polymorphism can be achieved with _________ .
A: Base class pointer and friend function
B: Derived class pointer and pure virtual function
C: Base class pointer and operator overloading
D: Base class pointer and virtual function
Difficulty Level: Difficult
Q. No. 12
______ is the property of an object that distinguishes it from all other object.
A: Identity
B: State
C: Behaviour.
D: None of the above.
Difficulty Level: Difficult
Q. No. 13
Compiler provided copy constructor does _________ .
A: Shallow copy B: Deep copy
C: Dynamic copy C: all of the above
Difficulty Level: Intermediate
Q. No. 14
Q. No. 15
How many constructors can implement in a class.
A: 1 B: 2
C: 3 D: It can be multiple as per need
Difficulty Level : Difficult
Q. No. 16
alias command is used for
A:Give another name for a file
B:Give another name for a directory
C:Give another name for a command
D:None of the above
Q. No. 17
BASH stands for
A:Bourne Advanced Shell
B:Bourne Again Shell
C:Bourne Applied Shell
D:None of the above
Q. No. 18
_________ script gets executed at every launch of shell
A: ~/.bash_profile B:/etc/profile C:~/.bash_rc D:~/.bashrc
Q. No. 19
__________ command is used to bring external file system into linux file system tree
A: umount B:mount C:mnt D:umnt
Q. No. 20
Give equivalent octal value for the permissions rwxr_xr_x
A: 644 B:755 C:756 D:666
Q. No. 21
_________ option of ls command is used to list hidden files also.
A: -a B:-h C:-v D:-p
Ans: A
Q. No. 22
What is the limitation of hard links
A:Can't be applied for directories
B:Can't be applied across the file systems
C:Both A&B
D:None of the above
Q. No. 23
tail -n +16 file
What is the purpose of above command
A. Display last 16 lines in a given file
B. Display first 16 lines in a given file
C. Display 16th line onwards in a file
D. None of the above
Q. No. 24
Q. No. 25
In a shell script $# stands for
A.No.of arguments B.Script name
C.All arguments D.exit status
Q. No. 26
_________ key word is used to delimit case control structure
A.endcase B.casend C.esac D.None of the above
Q. No. 27
a=10;b=20
test $a -lt $b
echo $?
________ is the output of above execution
A.1 B.0 C.10 D.-10
Q. No. 28
_________ command is used for floating point arithmetic
A.expr B.let C.bc D.All of the above
Q. No. 29
Wild card ? Stands for
A.Any type of any no. of characters
B.Any type of single characters
C.Any type of 1 or more characters
D.Any type of 0 or 1 character.
Q. No. 30
set 10 20 30 40 50
shift 2
expr $1 + $2
What is the output of above code
A.30 B.50 C.70 D.90
Q. No. 31
________ syntax used to take input from an user.
A: STDIN B: read C: <STDIN> D: <read>
Q. No. 32
_________ function remove the last character.
A: rm B: chop C: grep D: sed
Q. No. 33
find out correct statement?
A: perl variable have type and need to be initialized
B: perl variable have type and no need to be initialized
C: perl variable not have type and need to be initialized
D: perl variable not have type and no need to be initialized
Q. No. 34
$var = uc(“cdac”);
print $var
what will be output?
A: cdac B: CDAC C: Cdac D: C
Q. No. 35
__________ represent default variable.
A: $$ B: $* C: $_ D: $@
Q. No. 36
Current Line number can be represent by variable _____________.
A: $$ B: $. C: S* D: S_
Q. No. 37
Which notation can be used with associative array?
A: → B: <= C: => D: all of the above
Q. No. 38
my $var = 100;
{
$var = 200;
}
END {
$var = 300;
}
print $var;
What will be output?
A: 100 B: 200 C: 300 D: 0
Q. No. 39
my $var = '0';
if ($var) {
print "true";
Advance Computing Training School, C-DAC, Copyright © C-DAC, ACTS
Page 10 of 11
ACTS, C-DAC
} else {
print "false";
}
What will be output?
A: false B: true C: syntax error D: None of the above
Q. No. 40
________ stores all command line arguments.
A: argv B: argv[] C: @ARGV[]D: None of the above